diff options
author | Karel Zak | 2012-04-03 11:32:12 +0200 |
---|---|---|
committer | Karel Zak | 2012-04-03 11:32:12 +0200 |
commit | 7104bedb782f445bc432f877d993b682521cbdba (patch) | |
tree | b5eecc08bad3664ca95456218834df40449db57d /libmount/src/tab_parse.c | |
parent | mount: (old) check for LD_FLAGS_AUTOCLEAR more carefully (diff) | |
download | kernel-qcow2-util-linux-7104bedb782f445bc432f877d993b682521cbdba.tar.gz kernel-qcow2-util-linux-7104bedb782f445bc432f877d993b682521cbdba.tar.xz kernel-qcow2-util-linux-7104bedb782f445bc432f877d993b682521cbdba.zip |
libmount: clean up MNT_FMT_* usage in parser
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/tab_parse.c')
-rw-r--r-- | libmount/src/tab_parse.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c index 28c8536af..6d3e21d21 100644 --- a/libmount/src/tab_parse.c +++ b/libmount/src/tab_parse.c @@ -295,6 +295,7 @@ static int mnt_table_parse_next(struct libmnt_table *tb, FILE *f, struct libmnt_ { char buf[BUFSIZ]; char *s; + int rc; assert(tb); assert(f); @@ -329,23 +330,23 @@ static int mnt_table_parse_next(struct libmnt_table *tb, FILE *f, struct libmnt_ if (tb->fmt == MNT_FMT_GUESS) tb->fmt = guess_table_format(s); - if (tb->fmt == MNT_FMT_FSTAB) { - if (mnt_parse_table_line(fs, s) != 0) - goto err; - - } else if (tb->fmt == MNT_FMT_MOUNTINFO) { - if (mnt_parse_mountinfo_line(fs, s) != 0) - goto err; - - } else if (tb->fmt == MNT_FMT_UTAB) { - if (mnt_parse_utab_line(fs, s) != 0) - goto err; + switch (tb->fmt) { + case MNT_FMT_FSTAB: + rc = mnt_parse_table_line(fs, s); + break; + case MNT_FMT_MOUNTINFO: + rc = mnt_parse_mountinfo_line(fs, s); + break; + case MNT_FMT_UTAB: + rc = mnt_parse_utab_line(fs, s); + break; + default: + rc = -1; /* unknown format */ + break; } - - /*DBG(TAB, mnt_fs_print_debug(fs, stderr));*/ - - return 0; + if (rc == 0) + return 0; err: DBG(TAB, mnt_debug_h(tb, "%s:%d: %s parse error", filename, *nlines, tb->fmt == MNT_FMT_MOUNTINFO ? "mountinfo" : |