Btrfs-progs: Use /proc/mounts instead of /etc/mtab

/etc/mtab is not working correctly in situations where multiple
mount namespaces are used. Use /proc/mounts instead like the
rest of the code is doing it.

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
This commit is contained in:
Stefan Behrens 2013-03-25 15:21:42 +01:00 committed by David Sterba
parent 08fecd7658
commit f592cd1cc0

View File

@ -70,7 +70,7 @@ int find_mount_root(const char *path, char **mount_root)
return -errno;
close(fd);
mnttab = fopen("/etc/mtab", "r");
mnttab = fopen("/proc/mounts", "r");
while ((ent = getmntent(mnttab))) {
len = strlen(ent->mnt_dir);
if (strncmp(ent->mnt_dir, path, len) == 0) {