From: Peter TB Brett <peter@peter-b.co.uk>
To: libc-alpha@sourceware.org
Subject: [PATCH][BZ 15514] Use statvfs64() for pathconf(_PC_NAME_MAX).
Date: Mon, 07 Apr 2014 20:56:00 -0000 [thread overview]
Message-ID: <87ioqk270z.fsf@harrington.peter-b.co.uk> (raw)
[-- 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 --]
next reply other threads:[~2014-04-07 20:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-07 20:56 Peter TB Brett [this message]
2014-04-08 15:10 ` Ondřej Bílka
2014-04-08 23:10 ` Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ioqk270z.fsf@harrington.peter-b.co.uk \
--to=peter@peter-b.co.uk \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).