From patchwork Mon Apr 7 20:56:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter TB Brett X-Patchwork-Id: 337536 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 863D91400BE for ; Tue, 8 Apr 2014 06:56:23 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; q=dns; s=default; b=JoWuRpKqLnDb2zT1/sEA0CPndI4x9 mNRgYigOcFq+pw0xKOROwJ07JaI+BwgfiUwJ80Qc2449QHtVc6z7WmzRpPE3tTnc wKaVpVHuW+Ri+T2r+uKlYAWL61ITZIN8tv9s+gI/jS3n/+ji0X+kKNo8GN01YYmS bCqpRmvt68LJXI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; s=default; bh=KYfFwfCwzsO06AQDM9lz1qR9oMk=; b=U6H S7I2o1neb3yiZ1PSzA3XqDAaBaObr8lS7f8/sr+scpcpqtNNrZXCZ4m7IYbd5f6e QO6KA0aGvFhOw7Elzp4wL8Id4jkMxVwj23wHrcpeqohEa95xgMHb/+cRO27PoU5u s8MxAk9GevYVnf/AmKVd1e5CiRJ/zoJBmYpbZGj8= Received: (qmail 18648 invoked by alias); 7 Apr 2014 20:56:18 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 18632 invoked by uid 89); 7 Apr 2014 20:56:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=BAYES_00, KAM_COUK, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail.theimps.com From: Peter TB Brett To: libc-alpha@sourceware.org Subject: [PATCH][BZ 15514] Use statvfs64() for pathconf(_PC_NAME_MAX). Date: Mon, 07 Apr 2014 21:56:12 +0100 Message-ID: <87ioqk270z.fsf@harrington.peter-b.co.uk> MIME-Version: 1.0 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. From 39df7d3a6414920e6c241c23655acecb31bee0de Mon Sep 17 00:00:00 2001 From: Peter TB Brett 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 + + [BZ #15514] + * sysdeps/posix/pathconf.c (__pathconf): Use statvfs64() for + pathconf(_PC_NAME_MAX). + 2014-04-04 Chris Metcalf * 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