From 2f39e44a8417b4186a7f15bfeac5d0b557e63e03 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 27 Jan 2023 23:25:59 +0100 Subject: Account for octal marker in %#o format --- stdio-common/vfprintf-process-arg.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'stdio-common/vfprintf-process-arg.c') diff --git a/stdio-common/vfprintf-process-arg.c b/stdio-common/vfprintf-process-arg.c index 2c65194..24c9125 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); -- cgit v1.1