[PATCH] fix invalid printf format strings

Bernhard Fischer rep.nop at aon.at
Fri Mar 24 11:29:31 PST 2006


Hi dalias,

On Fri, Mar 24, 2006 at 01:37:29PM -0500, Rich Felker wrote:
>The attached patch changes all occurrances of %L[diouxX] to use %ll
>instead, conforming to C99 and SUSv3. The %L width specifier was
>intended only for use with floating types (for long double), not long
>long, and its behavior with integer types is unspecified.

No.

See tail of platform.h

We want make CC="cc -U_ -UN_" to dtrt, so pretty please rip them out
while you're touching these very same lines and resend. TIA.
>
>Rich
>

>Index: networking/interface.c
>===================================================================
>--- networking/interface.c	(revision 14622)
>+++ networking/interface.c	(working copy)
[hunk ok]
>@@ -1748,7 +1748,7 @@
> #endif
> 	} while (i);
> 
>-	printf("X bytes:%Lu (%Lu.%u %sB)%s", ull, int_part, frac_part, ext, end);
>+	printf("X bytes:%llu (%llu.%u %sB)%s", ull, int_part, frac_part, ext, end);
> }
> 
> static const char * const ife_print_flags_strs[] = {
hunk ok
>@@ -1989,7 +1989,7 @@
> 		 */
> 		printf("          ");
> 
>-		printf(_("RX packets:%Lu errors:%lu dropped:%lu overruns:%lu frame:%lu\n"),
>+		printf(_("RX packets:%llu errors:%lu dropped:%lu overruns:%lu frame:%lu\n"),
> 			   ptr->stats.rx_packets, ptr->stats.rx_errors,
> 			   ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors,
> 			   ptr->stats.rx_frame_errors);
-ENOPARSE
>@@ -1997,7 +1997,7 @@
> 			printf(_("             compressed:%lu\n"),
> 				   ptr->stats.rx_compressed);
> 		printf("          ");
>-		printf(_("TX packets:%Lu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n"),
>+		printf(_("TX packets:%llu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n"),
> 			   ptr->stats.tx_packets, ptr->stats.tx_errors,
> 			   ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors,
> 			   ptr->stats.tx_carrier_errors);
ditto.

cheers,
Bernhard


More information about the busybox mailing list