about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/pathconf.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-05-02 21:34:34 -0400
committerUlrich Drepper <drepper@gmail.com>2011-05-02 21:34:34 -0400
commit1bfbe0d335d3fc44a492648b974a0db19975f6d8 (patch)
treed6a53a04f34de9f8600c71dbd585780654b1ac6f /sysdeps/unix/sysv/linux/pathconf.c
parent0b592a30f5e3133bde98551fd524085359c3177a (diff)
downloadglibc-1bfbe0d335d3fc44a492648b974a0db19975f6d8.tar.gz
glibc-1bfbe0d335d3fc44a492648b974a0db19975f6d8.tar.xz
glibc-1bfbe0d335d3fc44a492648b974a0db19975f6d8.zip
Better use of open in pathconf.
Diffstat (limited to 'sysdeps/unix/sysv/linux/pathconf.c')
-rw-r--r--sysdeps/unix/sysv/linux/pathconf.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/pathconf.c b/sysdeps/unix/sysv/linux/pathconf.c
index 375d672925..52610a14d8 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);