From owner-freebsd-audit Sun Jul 22 3:37:11 2001 Delivered-To: freebsd-audit@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 982C937B403; Sun, 22 Jul 2001 03:37:06 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id UAA28130; Sun, 22 Jul 2001 20:37:03 +1000 Date: Sun, 22 Jul 2001 20:33:52 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Assar Westerlund Cc: des@FreeBSD.ORG, audit@FreeBSD.ORG Subject: Re: subf_printf warnings in linprocfs.c:linprocfs_donetdev In-Reply-To: <5lofqeknrp.fsf@assaris.sics.se> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 21 Jul 2001, Assar Westerlund wrote: > This gets rid of warnings from gcc's printf. Comments? > > /assar > > Index: linprocfs.c > =================================================================== > RCS file: /home/ncvs/src/sys/compat/linprocfs/linprocfs.c,v > retrieving revision 1.33 > diff -u -w -u -w -r1.33 linprocfs.c > --- linprocfs.c 2001/07/05 17:10:41 1.33 > +++ linprocfs.c 2001/07/21 20:51:38 > @@ -663,8 +663,8 @@ > sbuf_printf(sb, > "%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu " > "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n", > - 0, 0, 0, 0, 0, 0, 0, 0, > - 0, 0, 0, 0, 0, 0, 0, 0); > + 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, > + 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL); > } > > return (0); Changing all the %lu's to %d's would be better. Printing a literal string would be better still (the string must line up with the header, and this would be easier to see and maintain if it were literal like the header). Nearby bugs: - the header has hard tabs in it but the string in the above printf doesn't, so the string can't possibly line up with the header for all indentations. - the output is unreadably wide (119 columns). This may be necessary for bug for bug compatibility with Linux. This is obfuscated at the source level using ANSI string concatenation. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message