From: Joe Damato Date: Fri, 19 Jul 2013 05:35:45 +0000 (-0700) Subject: Handle the case where nl_msec2str is passed 0 msecs X-Git-Tag: libnl3_2_23rc1~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b3fb89f445108677d405c62865b25aeea209d10a;p=libnl Handle the case where nl_msec2str is passed 0 msecs --- 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)