Skip to contentSkip to conversation

libmount: initialize *root to NULL in mnt_table_get_root_fs

PATCH In review Thomas Bächler 2 participants 2 messages Feb 16, 2014 – Feb 17, 2014 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 libmount/src/tab.c | 1 +
 1 file changed, 1 insertion(+)
libmount/src/tab.c +1 -0
index 8ae49c8..7a253e8 100644
@@ -501,6 +501,7 @@ int mnt_table_get_root_fs(struct libmnt_table *tb, struct libmnt_fs **root)
 	struct libmnt_iter itr;
 	struct libmnt_fs *fs;
 	int root_id = 0;
+	*root = NULL;
 
 	assert(tb);
 	assert(root);
Signature · 1 line
1.8.5.4
maintainer
#1 lore raw
Quoted 2 lines · Thomas Bächler
 libmount/src/tab.c | 1 +
 1 file changed, 1 insertion(+)

Applied with a small change, thanks!

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com