summaryrefslogtreecommitdiff
path: root/src/kservice.c
diff options
context:
space:
mode:
authorMurphyZhao <[email protected]>2019-01-21 18:35:13 +0800
committerMurphyZhao <[email protected]>2019-01-21 19:28:44 +0800
commit5c76d3d51693144c8424f4ce6ea51ff229304fc4 (patch)
treea389ab21d28c3962a51a7179dfeae78bb27a6578 /src/kservice.c
parent929e9c8f4bba8125064ac60f8985c6faacec009b (diff)
[src][kservice.c] 修复 snprintf 中 `print_number` 函数错误解析 `.0` format 的问题
Signed-off-by: MurphyZhao <[email protected]>
Diffstat (limited to 'src/kservice.c')
-rw-r--r--src/kservice.c3
1 files changed, 2 insertions, 1 deletions
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];