]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
ionice: fix compiler warnings [-Wsign-compare]
authorKarel Zak <kzak@redhat.com>
Mon, 1 Aug 2011 11:17:54 +0000 (13:17 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 1 Aug 2011 11:17:54 +0000 (13:17 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
schedutils/ionice.c

index 75f372e0787f72112ef1b3450060ac6a74bc2829..18529753f4ffc35c8be724a5e4a46a2c9d181766 100644 (file)
@@ -59,7 +59,7 @@ const char *to_prio[] = {
 
 static int parse_ioclass(const char *str)
 {
-       int i;
+       size_t i;
 
        for (i = 0; i < ARRAY_SIZE(to_prio); i++)
                if (!strcasecmp(str, to_prio[i]))
@@ -77,7 +77,7 @@ static void ioprio_print(int pid)
                int ioclass = IOPRIO_PRIO_CLASS(ioprio);
                const char *name = _("unknown");
 
-               if (ioclass < ARRAY_SIZE(to_prio))
+               if (ioclass > 0 && (size_t) ioclass < ARRAY_SIZE(to_prio))
                        name = to_prio[ioclass];
 
                if (ioclass != IOPRIO_CLASS_IDLE)