* [PATCH][BZ 15514] Use statvfs64() for pathconf(_PC_NAME_MAX).
@ 2014-04-07 20:56 Peter TB Brett
2014-04-08 15:10 ` Ondřej Bílka
2014-04-08 23:10 ` Mike Frysinger
0 siblings, 2 replies; 3+ messages in thread
From: Peter TB Brett @ 2014-04-07 20:56 UTC (permalink / raw)
To: libc-alpha
[-- Attachment #1.1: Type: text/plain, Size: 442 bytes --]
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.
--
Dr Peter Brett <peter@peter-b.co.uk>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Use-statvfs64-for-pathconf-_PC_NAME_MAX-.-Bug-15514.patch --]
[-- Type: text/x-patch, Size: 1566 bytes --]
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(-)
diff --git a/ChangeLog b/ChangeLog
index a0bb465..5b94808 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/sysdeps/posix/pathconf.c b/sysdeps/posix/pathconf.c
index 8aa55e0..ac617d4 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
--
1.9.0
[-- Attachment #2: Type: application/pgp-signature, Size: 180 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][BZ 15514] Use statvfs64() for pathconf(_PC_NAME_MAX).
2014-04-07 20:56 [PATCH][BZ 15514] Use statvfs64() for pathconf(_PC_NAME_MAX) Peter TB Brett
@ 2014-04-08 15:10 ` Ondřej Bílka
2014-04-08 23:10 ` Mike Frysinger
1 sibling, 0 replies; 3+ messages in thread
From: Ondřej Bílka @ 2014-04-08 15:10 UTC (permalink / raw)
To: Peter TB Brett; +Cc: libc-alpha
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][BZ 15514] Use statvfs64() for pathconf(_PC_NAME_MAX).
2014-04-07 20:56 [PATCH][BZ 15514] Use statvfs64() for pathconf(_PC_NAME_MAX) Peter TB Brett
2014-04-08 15:10 ` Ondřej Bílka
@ 2014-04-08 23:10 ` Mike Frysinger
1 sibling, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2014-04-08 23:10 UTC (permalink / raw)
To: libc-alpha; +Cc: Peter TB Brett
[-- Attachment #1: Type: text/plain, Size: 365 bytes --]
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
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-04-08 23:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-07 20:56 [PATCH][BZ 15514] Use statvfs64() for pathconf(_PC_NAME_MAX) Peter TB Brett
2014-04-08 15:10 ` Ondřej Bílka
2014-04-08 23:10 ` Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).