]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: fix mnt_table_parse_stream() logic
authorKarel Zak <kzak@redhat.com>
Fri, 15 Apr 2016 12:30:43 +0000 (14:30 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 15 Apr 2016 14:29:17 +0000 (16:29 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/tab_parse.c

index 23076bfc0d55bdfaf5516e28e46956d98fa702be..0b858a043b88820a164908907e827534ea57bf9e 100644 (file)
@@ -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) {