Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jul 2001 20:33:52 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Assar Westerlund <assar@FreeBSD.ORG>
Cc:        des@FreeBSD.ORG, audit@FreeBSD.ORG
Subject:   Re: subf_printf warnings in linprocfs.c:linprocfs_donetdev
Message-ID:  <Pine.BSF.4.21.0107222016001.24964-100000@besplex.bde.org>
In-Reply-To: <5lofqeknrp.fsf@assaris.sics.se>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0107222016001.24964-100000>