]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
losetup: fix declarations [smatch scan]
authorSami Kerola <kerolasa@iki.fi>
Fri, 28 Dec 2012 21:23:43 +0000 (21:23 +0000)
committerKarel Zak <kzak@redhat.com>
Wed, 9 Jan 2013 12:37:23 +0000 (13:37 +0100)
sys-utils/losetup.c:309:2: error: 'for' loop initial declarations are only allowed in C99 mode
sys-utils/losetup.c:374:2: error: 'for' loop initial declarations are only allowed in C99 mode

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
sys-utils/losetup.c

index 2765a38bc7c47f29f206493f9328d54bd1a92c55..2c81e69ba011a9f7f41279a4229d8f6cda2249f3 100644 (file)
@@ -302,11 +302,12 @@ static int make_table(struct loopdev_cxt *lc, const char *file,
 {
        struct stat sbuf, *st = &sbuf;
        struct tt_line *ln;
+       int i;
 
        if (!(tt = tt_new_table(0)))
                errx(EXIT_FAILURE, _("failed to initialize output table"));
 
-       for (int i = 0; i < ncolumns; i++) {
+       for (i = 0; i < ncolumns; i++) {
                struct colinfo *ci = get_column_info(i);
 
                if (!tt_define_column(tt, ci->name, ci->whint, ci->flags))
@@ -341,6 +342,8 @@ static int make_table(struct loopdev_cxt *lc, const char *file,
 
 static void usage(FILE *out)
 {
+       size_t i;
+
        fputs(USAGE_HEADER, out);
 
        fprintf(out,
@@ -371,7 +374,7 @@ static void usage(FILE *out)
        fputs(USAGE_VERSION, out);
 
        fputs(_("\nAvailable --list columns:\n"), out);
-       for (size_t i = 0; i < NCOLS; i++)
+       for (i = 0; i < NCOLS; i++)
                fprintf(out, " %12s  %s\n", infos[i].name, _(infos[i].help));
 
        fprintf(out, USAGE_MAN_TAIL("losetup(8)"));