[BZ,15514] Use statvfs64() for pathconf(_PC_NAME_MAX).
Commit Message
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.
Peter
P.S. I haven't completed FSF copyright assignment.
Comments
On Mon, Apr 07, 2014 at 09:56:12PM +0100, Peter TB Brett wrote:
>
> 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.
>
> Peter
>
> P.S. I haven't completed FSF copyright assignment.
>
Looks ok for me.
Copyright assignment is not needed yet. As this is under 15 lines
its not legally significant.
http://www.gnu.org/prep/maintain/maintain.html#Legally-Significant
On Mon 07 Apr 2014 21:56:12 Peter TB Brett wrote:
> 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.
lgtm
-mike
From 39df7d3a6414920e6c241c23655acecb31bee0de Mon Sep 17 00:00:00 2001
From: Peter TB Brett <peter@peter-b.co.uk>
Date: Sun, 6 Apr 2014 10:51:05 +0100
Subject: [PATCH] Use statvfs64() for pathconf(_PC_NAME_MAX). [Bug #15514]
---
ChangeLog | 6 ++++++
sysdeps/posix/pathconf.c | 14 +++-----------
2 files changed, 9 insertions(+), 11 deletions(-)
@@ -1,3 +1,9 @@
+2014-04-06 Peter Brett <peter@peter-b.co.uk>
+
+ [BZ #15514]
+ * sysdeps/posix/pathconf.c (__pathconf): Use statvfs64() for
+ pathconf(_PC_NAME_MAX).
+
2014-04-04 Chris Metcalf <cmetcalf@tilera.com>
* sysdeps/tile/dl-runtime.c (_dl_unmap): Fix cut-and-paste bug
@@ -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
--
1.9.0