Fix BZ 18675 -- fpathconf(_PC_NAME_MAX) fails against large filesystems for 32bit processes

Message ID CAPC3xarKRKKOoqzdUAv22Jxm97U=POeXo6SU-y+OkWyjufAJFQ@mail.gmail.com
State Committed
Headers

Commit Message

Paul Pluzhnikov Sept. 6, 2015, 10 p.m. UTC
  Greetings,

The patch attached to
https://sourceware.org/bugzilla/show_bug.cgi?id=18675 looks good to
me.

I am not sure whether Justin has the paterwork filed, but since this
is on the trivial side and is directly patterned after the fix for
https://sourceware.org/bugzilla/show_bug.cgi?id=15514, perhaps that's
ok?

Tested on Linux/x86_64 and i386. No new failures.

Thanks,

2015-09-06  Justin Maggard  <jmaggard@netgear.com>

        [BZ #18675]
        * sysdeps/posix/fpathconf.c (__fpathconf): Use __fstatvfs64.
  

Comments

Roland McGrath Sept. 8, 2015, 8:35 p.m. UTC | #1
Looks OK to me.
  

Patch

diff --git a/sysdeps/posix/fpathconf.c b/sysdeps/posix/fpathconf.c
index 25f632e..088eb15 100644
--- a/sysdeps/posix/fpathconf.c
+++ b/sysdeps/posix/fpathconf.c
@@ -66,10 +66,10 @@  __fpathconf (fd, name)
     case _PC_NAME_MAX:
 #ifdef	NAME_MAX
       {
-	struct statfs buf;
+	struct statvfs64 sv;
 	int save_errno = errno;
 
-	if (__fstatfs (fd, &buf) < 0)
+	if (__fstatvfs64 (fd, &sv) < 0)
 	  {
 	    if (errno == ENOSYS)
 	      {
@@ -83,15 +83,7 @@  __fpathconf (fd, name)
 	  }
 	else
 	  {
-#ifdef _STATFS_F_NAMELEN
-	    return buf.f_namelen;
-#else
-# ifdef _STATFS_F_NAME_MAX
-	    return buf.f_name_max;
-# else
-	    return NAME_MAX;
-# endif
-#endif
+	    return sv.f_namemax;
 	  }
       }
 #else