From b3fb89f445108677d405c62865b25aeea209d10a Mon Sep 17 00:00:00 2001 From: Joe Damato Date: Thu, 18 Jul 2013 22:35:45 -0700 Subject: [PATCH] Handle the case where nl_msec2str is passed 0 msecs --- lib/utils.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/utils.c b/lib/utils.c index 234e0de..c04d83f 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -559,6 +559,11 @@ char * nl_msec2str(uint64_t msec, char *buf, size_t len) #undef _SPLIT split[4] = msec; + if (msec == 0) { + snprintf(buf, len, "0msec"); + return buf_orig; + } + for (i = 0; i < ARRAY_SIZE(split) && len; i++) { int l; if (split[i] == 0) -- 2.40.0