[PATCH] Fix signedness issue
Don't compare standard char to -1.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/init.c b/init.c
index 00f9576..badd635 100644
--- a/init.c
+++ b/init.c
@@ -516,16 +516,16 @@
static char *to_kmg(unsigned int val)
{
char *buf = malloc(32);
- char post[] = { 0, 'K', 'M', 'G', 'P', -1 };
+ char post[] = { 0, 'K', 'M', 'G', 'P', 0 };
char *p = post;
- while (*p != -1) {
+ do {
if (val & 1023)
break;
val >>= 10;
p++;
- }
+ } while (*p);
snprintf(buf, 31, "%u%c", val, *p);
return buf;