]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: initialize *root to NULL in mnt_table_get_root_fs
authorThomas Bächler <thomas@archlinux.org>
Sun, 16 Feb 2014 13:58:06 +0000 (14:58 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 23 Apr 2014 08:54:31 +0000 (10:54 +0200)
mnt_table_get_root_fs only works when *root is set to NULL. This
is not only undocumented, but also unintuitive. Fix it by initializing
*root inside mnt_table_get_root_fs.

Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/tab.c

index 3633b6aa08b04ebd4e3d76c3199f0dabf5149a28..80b225e3fea6cf2990e655fa5dd11913da9d0ab0 100644 (file)
@@ -496,6 +496,8 @@ int mnt_table_get_root_fs(struct libmnt_table *tb, struct libmnt_fs **root)
 
        DBG(TAB, mnt_debug_h(tb, "lookup root fs"));
 
+       *root = NULL;
+
        mnt_reset_iter(&itr, MNT_ITER_FORWARD);
        while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
                int id = mnt_fs_get_parent_id(fs);