Supress verbose stderr messages while trying to find my exec path.

Per report from Christopher.
This commit is contained in:
Bruce Momjian 2004-05-19 04:36:33 +00:00
parent 132d09054e
commit dbb9aa224e
1 changed files with 1 additions and 13 deletions

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/port/exec.c,v 1.8 2004/05/18 20:18:59 momjian Exp $ * $PostgreSQL: pgsql/src/port/exec.c,v 1.9 2004/05/19 04:36:33 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -92,16 +92,10 @@ validate_exec(char *path)
* instead of the underlying file, you lose. * instead of the underlying file, you lose.
*/ */
if (stat(path, &buf) < 0) if (stat(path, &buf) < 0)
{
fprintf(stderr, "could not stat \"%s\": %m", path);
return -1; return -1;
}
if ((buf.st_mode & S_IFMT) != S_IFREG) if ((buf.st_mode & S_IFMT) != S_IFREG)
{
fprintf(stderr, "\"%s\" is not a regular file", path);
return -1; return -1;
}
/* /*
* Ensure that we are using an authorized executable. * Ensure that we are using an authorized executable.
@ -123,8 +117,6 @@ validate_exec(char *path)
{ {
is_r = buf.st_mode & S_IRUSR; is_r = buf.st_mode & S_IRUSR;
is_x = buf.st_mode & S_IXUSR; is_x = buf.st_mode & S_IXUSR;
if (!(is_r && is_x))
fprintf(stderr, "\"%s\" is not user read/execute", path);
return is_x ? (is_r ? 0 : -2) : -1; return is_x ? (is_r ? 0 : -2) : -1;
} }
@ -152,8 +144,6 @@ validate_exec(char *path)
{ {
is_r = buf.st_mode & S_IRGRP; is_r = buf.st_mode & S_IRGRP;
is_x = buf.st_mode & S_IXGRP; is_x = buf.st_mode & S_IXGRP;
if (!(is_r && is_x))
fprintf(stderr, "\"%s\" is not group read/execute", path);
return is_x ? (is_r ? 0 : -2) : -1; return is_x ? (is_r ? 0 : -2) : -1;
} }
} }
@ -161,8 +151,6 @@ validate_exec(char *path)
/* Check "other" bits */ /* Check "other" bits */
is_r = buf.st_mode & S_IROTH; is_r = buf.st_mode & S_IROTH;
is_x = buf.st_mode & S_IXOTH; is_x = buf.st_mode & S_IXOTH;
if (!(is_r && is_x))
fprintf(stderr, "\"%s\" is not other read/execute", path);
return is_x ? (is_r ? 0 : -2) : -1; return is_x ? (is_r ? 0 : -2) : -1;
#endif #endif