From owner-freebsd-bugs@FreeBSD.ORG Wed Apr 27 16:40:11 2005 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1F7D216A4CF for ; Wed, 27 Apr 2005 16:40:11 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D62E043D6A for ; Wed, 27 Apr 2005 16:40:10 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j3RGeAQP024520 for ; Wed, 27 Apr 2005 16:40:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j3RGeAUO024519; Wed, 27 Apr 2005 16:40:10 GMT (envelope-from gnats) Resent-Date: Wed, 27 Apr 2005 16:40:10 GMT Resent-Message-Id: <200504271640.j3RGeAUO024519@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Steve Ames Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7789016A4CE for ; Wed, 27 Apr 2005 16:39:56 +0000 (GMT) Received: from basement.virtual-voodoo.com (12-202-93-96.client.insightBB.com [12.202.93.96]) by mx1.FreeBSD.org (Postfix) with ESMTP id E705143D1D for ; Wed, 27 Apr 2005 16:39:55 +0000 (GMT) (envelope-from steve@basement.virtual-voodoo.com) Received: from basement.virtual-voodoo.com (localhost [127.0.0.1]) j3RGdsmY085559 for ; Wed, 27 Apr 2005 11:39:55 -0500 (EST) (envelope-from steve@basement.virtual-voodoo.com) Received: (from root@localhost)j3RGdslv082937; Wed, 27 Apr 2005 11:39:54 -0500 (EST) (envelope-from steve) Message-Id: <200504271639.j3RGdslv082937@basement.virtual-voodoo.com> Date: Wed, 27 Apr 2005 11:39:54 -0500 (EST) From: Steve Ames To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/80411: bin/df/df.c sign errors in calls to getbsize X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Steve Ames List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2005 16:40:11 -0000 >Number: 80411 >Category: bin >Synopsis: bin/df/df.c sign errors in calls to getbsize >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Apr 27 16:40:10 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Steve Ames >Release: FreeBSD 6.0-CURRENT i386 >Organization: >Environment: System: FreeBSD basement.virtual-voodoo.com 6.0-CURRENT FreeBSD 6.0-CURRENT #48: Sun Apr 24 13:04:02 EST 2005 steve@basement.virtual-voodoo.com:/usr/obj/usr/src/sys/SB i386 >Description: in bin/df/df.c calls are made getbsize(3) using a variable of type u_long when the prototype specifically requests long: char *getbsize(int *headerlenp, long *blocksizep); The solution is to fix the calls to send signed long instead of u_long. I'm fairly sure that a negative value will never be placed in blocksizep so u_long seems to be appropriate but until (and unless) the prototype and library are changed to unsigned then calls to getbsize should use signed variables to avoid confusion. This becomes more true with gcc4.0 and higher where sign warnings are flagged a little heavier. >How-To-Repeat: Not Applicable >Fix: --- df.c.old Wed Apr 27 11:28:11 2005 +++ df.c Wed Apr 27 11:29:32 2005 @@ -372,7 +372,7 @@ static void prtstat(struct statfs *sfsp, struct maxwidths *mwp) { - static u_long blocksize; + static long blocksize; static int headerlen, timesthrough = 0; static const char *header; int64_t used, availblks, inodes; @@ -449,7 +449,7 @@ static void update_maxwidths(struct maxwidths *mwp, const struct statfs *sfsp) { - static u_long blocksize = 0; + static long blocksize = 0; int dummy; if (blocksize == 0) >Release-Note: >Audit-Trail: >Unformatted: