From e6e91f5c2fac25d5f497efa70e7ffb7bdf4987b0 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Wed, 1 Jul 2015 10:24:50 +0100 Subject: [PATCH] Accept %z in printf formats Before, we only supported %Z (upper-case). It seems that the lower-case version is standard, and this matches the behaviour of Xen's vsprintf.c. Signed-off-by: Thomas Leonard Acked-by: Samuel Thibault --- lib/printf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/printf.c b/lib/printf.c index 3d02e95..40f92fc 100644 --- a/lib/printf.c +++ b/lib/printf.c @@ -346,12 +346,14 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) /* get the conversion qualifier */ qualifier = -1; - if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt =='Z') { + if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt =='Z' || *fmt == 'z') { qualifier = *fmt; ++fmt; if (qualifier == 'l' && *fmt == 'l') { qualifier = 'L'; ++fmt; + } else if (qualifier == 'z') { + qualifier = 'Z'; } } if (*fmt == 'q') { -- 2.39.5