1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

Error message editing in backend/utils (except /adt).

This commit is contained in:
Tom Lane
2003-07-25 20:18:01 +00:00
parent 9fecf302f7
commit 689eb53e47
29 changed files with 739 additions and 521 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.34 2003/05/27 17:49:46 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.35 2003/07/25 20:17:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -62,13 +62,13 @@ ValidateBinary(char *path)
*/
if (stat(path, &buf) < 0)
{
elog(DEBUG3, "ValidateBinary: can't stat \"%s\"", path);
elog(DEBUG3, "could not stat \"%s\": %m", path);
return -1;
}
if ((buf.st_mode & S_IFMT) != S_IFREG)
{
elog(DEBUG3, "ValidateBinary: \"%s\" is not a regular file", path);
elog(DEBUG3, "\"%s\" is not a regular file", path);
return -1;
}
@@ -95,7 +95,7 @@ ValidateBinary(char *path)
is_r = buf.st_mode & S_IRUSR;
is_x = buf.st_mode & S_IXUSR;
if (!(is_r && is_x))
elog(DEBUG3, "ValidateBinary: \"%s\" is not user read/execute", path);
elog(DEBUG3, "\"%s\" is not user read/execute", path);
return is_x ? (is_r ? 0 : -2) : -1;
}
pwp = getpwuid(euid);
@@ -121,16 +121,14 @@ ValidateBinary(char *path)
is_r = buf.st_mode & S_IRGRP;
is_x = buf.st_mode & S_IXGRP;
if (!(is_r && is_x))
elog(DEBUG3, "ValidateBinary: \"%s\" is not group read/execute",
path);
elog(DEBUG3, "\"%s\" is not group read/execute", path);
return is_x ? (is_r ? 0 : -2) : -1;
}
}
is_r = buf.st_mode & S_IROTH;
is_x = buf.st_mode & S_IXOTH;
if (!(is_r && is_x))
elog(DEBUG3, "ValidateBinary: \"%s\" is not other read/execute",
path);
elog(DEBUG3, "\"%s\" is not other read/execute", path);
return is_x ? (is_r ? 0 : -2) : -1;
#endif
}
@@ -179,10 +177,10 @@ FindExec(char *full_path, const char *argv0, const char *binary_name)
if (ValidateBinary(buf) == 0)
{
strncpy(full_path, buf, MAXPGPATH);
elog(DEBUG2, "FindExec: found \"%s\" using argv[0]", full_path);
elog(DEBUG2, "found \"%s\" using argv[0]", full_path);
return 0;
}
elog(LOG, "FindExec: invalid binary \"%s\"", buf);
elog(DEBUG2, "invalid binary \"%s\"", buf);
return -1;
}
@@ -192,7 +190,7 @@ FindExec(char *full_path, const char *argv0, const char *binary_name)
*/
if ((p = getenv("PATH")) && *p)
{
elog(DEBUG2, "FindExec: searching PATH ...");
elog(DEBUG2, "searching PATH for executable");
path = strdup(p); /* make a modifiable copy */
for (startp = path, endp = strchr(path, ':');
startp && *startp;
@@ -213,14 +211,13 @@ FindExec(char *full_path, const char *argv0, const char *binary_name)
{
case 0: /* found ok */
strncpy(full_path, buf, MAXPGPATH);
elog(DEBUG2, "FindExec: found \"%s\" using PATH",
full_path);
elog(DEBUG2, "found \"%s\" using PATH", full_path);
free(path);
return 0;
case -1: /* wasn't even a candidate, keep looking */
break;
case -2: /* found but disqualified */
elog(LOG, "FindExec: could not read binary \"%s\"", buf);
elog(DEBUG2, "could not read binary \"%s\"", buf);
free(path);
return -1;
}
@@ -230,6 +227,6 @@ FindExec(char *full_path, const char *argv0, const char *binary_name)
free(path);
}
elog(LOG, "FindExec: could not find a %s to execute", binary_name);
elog(DEBUG2, "could not find a \"%s\" to execute", binary_name);
return -1;
}