From: Ulrich Drepper Date: Tue, 3 May 2011 01:34:34 +0000 (-0400) Subject: Better use of open in pathconf. X-Git-Tag: glibc-2.14~154 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1bfbe0d335d3fc44a492648b974a0db19975f6d8;p=thirdparty%2Fglibc.git Better use of open in pathconf. --- diff --git a/sysdeps/unix/sysv/linux/pathconf.c b/sysdeps/unix/sysv/linux/pathconf.c index 375d6729259..52610a14d8c 100644 --- a/sysdeps/unix/sysv/linux/pathconf.c +++ b/sysdeps/unix/sysv/linux/pathconf.c @@ -37,6 +37,7 @@ __pathconf (const char *file, int name) { struct statfs fsbuf; int fd; + int flags; switch (name) { @@ -53,7 +54,11 @@ __pathconf (const char *file, int name) return __statfs_chown_restricted (__statfs (file, &fsbuf), &fsbuf); case _PC_PIPE_BUF: - fd = open_not_cancel_2 (file, O_RDONLY|O_NONBLOCK); + flags = O_RDONLY|O_NONBLOCK|O_NOCTTY; +#ifdef O_CLOEXEC + flags |= O_CLOEXEC; +#endif + fd = open_not_cancel_2 (file, flags); if (fd >= 0) { long int r = __fcntl (fd, F_GETPIPE_SZ);