Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dbb9aa2

Browse files
committed
Supress verbose stderr messages while trying to find my exec path.
Per report from Christopher.
1 parent 132d090 commit dbb9aa2

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

src/port/exec.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/port/exec.c,v 1.8 2004/05/18 20:18:59 momjian Exp $
10+
* $PostgreSQL: pgsql/src/port/exec.c,v 1.9 2004/05/19 04:36:33 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -92,16 +92,10 @@ validate_exec(char *path)
9292
* instead of the underlying file, you lose.
9393
*/
9494
if (stat(path, &buf) < 0)
95-
{
96-
fprintf(stderr, "could not stat \"%s\": %m", path);
9795
return -1;
98-
}
9996

10097
if ((buf.st_mode & S_IFMT) != S_IFREG)
101-
{
102-
fprintf(stderr, "\"%s\" is not a regular file", path);
10398
return -1;
104-
}
10599

106100
/*
107101
* Ensure that we are using an authorized executable.
@@ -123,8 +117,6 @@ validate_exec(char *path)
123117
{
124118
is_r = buf.st_mode & S_IRUSR;
125119
is_x = buf.st_mode & S_IXUSR;
126-
if (!(is_r && is_x))
127-
fprintf(stderr, "\"%s\" is not user read/execute", path);
128120
return is_x ? (is_r ? 0 : -2) : -1;
129121
}
130122

@@ -152,17 +144,13 @@ validate_exec(char *path)
152144
{
153145
is_r = buf.st_mode & S_IRGRP;
154146
is_x = buf.st_mode & S_IXGRP;
155-
if (!(is_r && is_x))
156-
fprintf(stderr, "\"%s\" is not group read/execute", path);
157147
return is_x ? (is_r ? 0 : -2) : -1;
158148
}
159149
}
160150

161151
/* Check "other" bits */
162152
is_r = buf.st_mode & S_IROTH;
163153
is_x = buf.st_mode & S_IXOTH;
164-
if (!(is_r && is_x))
165-
fprintf(stderr, "\"%s\" is not other read/execute", path);
166154
return is_x ? (is_r ? 0 : -2) : -1;
167155

168156
#endif

0 commit comments

Comments
 (0)