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 20:59:51 -0400
committerUlrich Drepper <drepper@gmail.com>2011-05-02 20:59:51 -0400
commit6e04cbbe79f5965809fdbf1f28d7ae8b4af74d31 (patch)
treeb3c8797cdfe8f6472089d3a7cecfc3ef48393459 /sysdeps/unix/sysv/linux/pathconf.c
parent6fdb1ce876d4f2e4215f549a68826c004fd1c283 (diff)
downloadglibc-6e04cbbe79f5965809fdbf1f28d7ae8b4af74d31.tar.gz
glibc-6e04cbbe79f5965809fdbf1f28d7ae8b4af74d31.tar.xz
glibc-6e04cbbe79f5965809fdbf1f28d7ae8b4af74d31.zip
Fix pathconf(_PC_BUF_SIZE).
Diffstat (limited to 'sysdeps/unix/sysv/linux/pathconf.c')
-rw-r--r--sysdeps/unix/sysv/linux/pathconf.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/pathconf.c b/sysdeps/unix/sysv/linux/pathconf.c
index ae597fb5ba..375d672925 100644
--- a/sysdeps/unix/sysv/linux/pathconf.c
+++ b/sysdeps/unix/sysv/linux/pathconf.c
@@ -1,5 +1,5 @@
 /* Get file-specific information about a file.  Linux version.
-   Copyright (C) 1991,1995,1996,1998-2003,2008,2010 Free Software Foundation, Inc.
+   Copyright (C) 1991,1995,1996,1998-2003,2008,2010,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -36,6 +36,7 @@ long int
 __pathconf (const char *file, int name)
 {
   struct statfs fsbuf;
+  int fd;
 
   switch (name)
     {
@@ -51,6 +52,17 @@ __pathconf (const char *file, int name)
     case _PC_CHOWN_RESTRICTED:
       return __statfs_chown_restricted (__statfs (file, &fsbuf), &fsbuf);
 
+    case _PC_PIPE_BUF:
+      fd = open_not_cancel_2 (file, O_RDONLY|O_NONBLOCK);
+      if (fd >= 0)
+	{
+	  long int r = __fcntl (fd, F_GETPIPE_SZ);
+	  close_not_cancel_no_status (fd);
+	  if (r > 0)
+	    return r;
+	}
+      /* FALLTHROUGH */
+
     default:
       return posix_pathconf (file, name);
     }