From: Thomas Bächler Date: Sun, 16 Feb 2014 13:58:06 +0000 (+0100) Subject: libmount: initialize *root to NULL in mnt_table_get_root_fs X-Git-Tag: v2.25-rc1~595 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2e358a901f0a20fe9abe68f9ce6ce3efa87836dd;p=thirdparty%2Futil-linux.git libmount: initialize *root to NULL in mnt_table_get_root_fs 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 --- diff --git a/libmount/src/tab.c b/libmount/src/tab.c index 8ae49c8dfe..4c2f8a4ace 100644 --- a/libmount/src/tab.c +++ b/libmount/src/tab.c @@ -510,6 +510,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);