[PATCH] libmount: initialize *root to NULL in mnt_table_get_root_fs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux