public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libmount: initialize *root to NULL in mnt_table_get_root_fs
@ 2014-02-16 13:58 Thomas Bächler
  2014-02-17 12:37 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Bächler @ 2014-02-16 13:58 UTC (permalink / raw)
  To: util-linux; +Cc: Thomas Bächler

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(+)

diff --git a/libmount/src/tab.c b/libmount/src/tab.c
index 8ae49c8..7a253e8 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -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);
-- 
1.8.5.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-17 12:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-16 13:58 [PATCH] libmount: initialize *root to NULL in mnt_table_get_root_fs Thomas Bächler
2014-02-17 12:37 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox