forked from Mirrors/btrfs-progs
btrfs-progs: use mntent functions in find_mount_root
getmntent should be used in context of *mntent functions, though fopen/fclose works. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>master
parent
37cd29521a
commit
387d5f3234
|
@ -72,7 +72,7 @@ int find_mount_root(const char *path, char **mount_root)
|
|||
return -errno;
|
||||
close(fd);
|
||||
|
||||
mnttab = fopen("/proc/self/mounts", "r");
|
||||
mnttab = setmntent("/proc/self/mounts", "r");
|
||||
if (!mnttab)
|
||||
return -errno;
|
||||
|
||||
|
@ -87,7 +87,7 @@ int find_mount_root(const char *path, char **mount_root)
|
|||
}
|
||||
}
|
||||
}
|
||||
fclose(mnttab);
|
||||
endmntent(mnttab);
|
||||
|
||||
if (!longest_match) {
|
||||
fprintf(stderr,
|
||||
|
|
Loading…
Reference in New Issue