summaryrefslogtreecommitdiffstats
path: root/libmount/src/tab_parse.c
diff options
context:
space:
mode:
authorKarel Zak2016-04-15 14:30:43 +0200
committerKarel Zak2016-04-15 14:30:43 +0200
commit4b85aef355e4a1a783c7fcf693575e85c366d90b (patch)
treeacf4c5e152d40a3d1656fd63066fc2c64133fc38 /libmount/src/tab_parse.c
parenttests: make tests more portable due to mtab (diff)
downloadkernel-qcow2-util-linux-4b85aef355e4a1a783c7fcf693575e85c366d90b.tar.gz
kernel-qcow2-util-linux-4b85aef355e4a1a783c7fcf693575e85c366d90b.tar.xz
kernel-qcow2-util-linux-4b85aef355e4a1a783c7fcf693575e85c366d90b.zip
libmount: fix mnt_table_parse_stream() logic
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/tab_parse.c')
-rw-r--r--libmount/src/tab_parse.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c
index 044e15415..264b8ca37 100644
--- a/libmount/src/tab_parse.c
+++ b/libmount/src/tab_parse.c
@@ -590,6 +590,9 @@ static int kernel_fs_postparse(struct libmnt_table *tb,
DBG(TAB, ul_debugobj(tb, "canonical root FS: %s", real));
rc = __mnt_fs_set_source_ptr(fs, real);
}
+ /* mnt_guess_system_root() returns 1 if not able to conver to
+ * the real devname; ignore this problem */
+ rc = 0;
}
return rc;
@@ -644,8 +647,11 @@ int mnt_table_parse_stream(struct libmnt_table *tb, FILE *f, const char *filenam
rc = mnt_table_add_fs(tb, fs);
fs->flags |= flags;
- if (rc == 0 && tb->fmt == MNT_FMT_MOUNTINFO)
+ if (rc == 0 && tb->fmt == MNT_FMT_MOUNTINFO) {
rc = kernel_fs_postparse(tb, fs, &tid, filename);
+ if (rc)
+ mnt_table_remove_fs(tb, fs);
+ }
}
if (rc) {