From 2e358a901f0a20fe9abe68f9ce6ce3efa87836dd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20B=C3=A4chler?= Date: Sun, 16 Feb 2014 14:58:06 +0100 Subject: [PATCH] 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 --- libmount/src/tab.c | 2 ++ 1 file changed, 2 insertions(+) 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); -- 2.47.2