[PATCH 4/4] losetup: fix declarations [smatch scan]

Sami Kerola
2012-12-28T21:24:00Z

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 | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c
index 2765a38..2c81e69 100644
--- a/sys-utils/losetup.c
+++ b/sys-utils/losetup.c
@@ -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)"));
--
1.8.0.3