Module Name:    src
Committed By:   mlelstv
Date:           Sat Aug 31 07:12:57 UTC 2024

Modified Files:
        src/sys/lib/libsa: subr_prf.c

Log Message:
Only a leading '0' in a format width marks zero-padding, otherwise
it's a regular digit.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/lib/libsa/subr_prf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/lib/libsa/subr_prf.c
diff -u src/sys/lib/libsa/subr_prf.c:1.30 src/sys/lib/libsa/subr_prf.c:1.31
--- src/sys/lib/libsa/subr_prf.c:1.30	Mon May 29 03:56:52 2023
+++ src/sys/lib/libsa/subr_prf.c	Sat Aug 31 07:12:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_prf.c,v 1.30 2023/05/29 03:56:52 rin Exp $	*/
+/*	$NetBSD: subr_prf.c,v 1.31 2024/08/31 07:12:57 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -197,8 +197,11 @@ reswitch:
 			lflag |= SIGN;
 			goto reswitch;
 		case '0':
-			lflag |= ZEROPAD;
-			goto reswitch;
+			if (width == 0) {
+				lflag |= ZEROPAD;
+				goto reswitch;
+			}
+			/* FALLTHROUGH */
 		case '1': case '2': case '3': case '4': case '5':
 		case '6': case '7': case '8': case '9':
 			for (;;) {

Reply via email to