From eb2d5f115d42943390fc9a8aa258fa36f6397e25 Mon Sep 17 00:00:00 2001
From: Armin Luntzer <armin.luntzer@univie.ac.at>
Date: Tue, 29 May 2018 15:52:41 +0200
Subject: [PATCH] vsnprintf: restructure loop, so values == 0 are printed as
 well

---
 lib/vsnprintf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/vsnprintf.c b/lib/vsnprintf.c
index 2f572df..5f38a3d 100644
--- a/lib/vsnprintf.c
+++ b/lib/vsnprintf.c
@@ -555,7 +555,7 @@ static size_t render_xlong_to_ascii(bool usign, long value, char *str,
 		}
 	}
 
-	while (value && (n < STACK_BUF_SIZE)) {
+	do {
 
 		digit = (char) (value % spec->base);
 
@@ -572,7 +572,7 @@ static size_t render_xlong_to_ascii(bool usign, long value, char *str,
 
 		n++;
 		value /= spec->base;
-	}
+	} while (value && (n < STACK_BUF_SIZE));
 
 	return render_final(str, end, sign, buf, n, spec);
 }
-- 
GitLab