summaryrefslogtreecommitdiff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorPeter TB Brett <peter@peter-b.co.uk>2014-04-07 21:56:12 +0100
committerOndřej Bílka <neleai@seznam.cz>2014-04-09 20:09:56 +0200
commita88ddc902b804a6156f6e5e5feb979754a3e789a (patch)
tree78aa9baadcac6ec1f08747d270d3fb2f3744c92d /sysdeps/posix
parent01f8eac224421f07f28f91cc05db7459ea433ea4 (diff)
downloadglibc-a88ddc902b804a6156f6e5e5feb979754a3e789a.tar.gz
Use statvfs64() for pathconf(_PC_NAME_MAX).
pathconf(_PC_NAME_MAX) was implemented on top of statfs(). The 32bit version therefore fails EOVERFLOW if the filesystem blockcount is sufficiently large. Most pathconf() queries use statvfs64(), which avoids this issue. This patch modifies pathconf(_PC_NAME_MAX) to do likewise.
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/pathconf.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/sysdeps/posix/pathconf.c b/sysdeps/posix/pathconf.c
index 8aa55e0856..ac617d4a08 100644
--- a/sysdeps/posix/pathconf.c
+++ b/sysdeps/posix/pathconf.c
@@ -65,10 +65,10 @@ __pathconf (const char *path, int name)
case _PC_NAME_MAX:
#ifdef NAME_MAX
{
- struct statfs buf;
+ struct statvfs64 sv;
int save_errno = errno;
- if (__statfs (path, &buf) < 0)
+ if (__statvfs64 (path, &sv) < 0)
{
if (errno == ENOSYS)
{
@@ -79,15 +79,7 @@ __pathconf (const char *path, int 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