about summary refs log tree commit diff
path: root/stdio-common/vfprintf-process-arg.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2023-01-27 23:25:59 +0100
committerAndreas Schwab <schwab@suse.de>2023-01-30 16:56:07 +0100
commit2f39e44a8417b4186a7f15bfeac5d0b557e63e03 (patch)
treea62284d1406343962cd1845908c6366395a89be8 /stdio-common/vfprintf-process-arg.c
parent90dffec958f4d423435d155939ef8abf4fedd1f1 (diff)
downloadglibc-2f39e44a8417b4186a7f15bfeac5d0b557e63e03.tar.gz
glibc-2f39e44a8417b4186a7f15bfeac5d0b557e63e03.tar.xz
glibc-2f39e44a8417b4186a7f15bfeac5d0b557e63e03.zip
Account for octal marker in %#o format
Diffstat (limited to 'stdio-common/vfprintf-process-arg.c')
-rw-r--r--stdio-common/vfprintf-process-arg.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/stdio-common/vfprintf-process-arg.c b/stdio-common/vfprintf-process-arg.c
index 2c651946df..24c9125f9f 100644
--- a/stdio-common/vfprintf-process-arg.c
+++ b/stdio-common/vfprintf-process-arg.c
@@ -196,6 +196,9 @@ LABEL (unsigned_number):      /* Unsigned number of base BASE.  */
         /* Account for 0X, 0x, 0B or 0b hex or binary marker.  */
         width -= 2;
 
+      if (octal_marker)
+        --width;
+
       if (is_negative || showsign || space)
         --width;
 
@@ -257,6 +260,9 @@ LABEL (unsigned_number):      /* Unsigned number of base BASE.  */
           width -= 2;
         }
 
+      if (octal_marker)
+	--width;
+
       width -= workend - string + prec;
 
       Xprintf_buffer_pad (buf, L_('0'), prec);