From 5c76d3d51693144c8424f4ce6ea51ff229304fc4 Mon Sep 17 00:00:00 2001 From: MurphyZhao Date: Mon, 21 Jan 2019 18:35:13 +0800 Subject: [PATCH] =?UTF-8?q?[src][kservice.c]=20=E4=BF=AE=E5=A4=8D=20snprin?= =?UTF-8?q?tf=20=E4=B8=AD=20`print=5Fnumber`=20=E5=87=BD=E6=95=B0=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E8=A7=A3=E6=9E=90=20`.0`=20format=20=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MurphyZhao --- src/kservice.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/kservice.c b/src/kservice.c index c938f4110a..35a9210c25 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -601,6 +601,7 @@ static char *print_number(char *buf, #else char tmp[16]; #endif + int precision_bak = precision; const char *digits; static const char small_digits[] = "0123456789abcdef"; static const char large_digits[] = "0123456789ABCDEF"; @@ -724,7 +725,7 @@ static char *print_number(char *buf, #endif /* put number in the temporary buffer */ - while (i-- > 0) + while (i-- > 0 && (precision_bak != 0)) { if (buf <= end) *buf = tmp[i];