Permalink
Browse files

Handle the case where nl_msec2str is passed 0 msecs

  • Loading branch information...
1 parent 81d2b1d commit b3fb89f445108677d405c62865b25aeea209d10a @ice799 ice799 committed Jul 19, 2013
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/utils.c
View
5 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)

0 comments on commit b3fb89f

Please sign in to comment.