btrfs-progs: use mntent functions in find_mount_root
authorDavid Sterba <dsterba@suse.cz>
Wed, 27 Nov 2013 17:22:34 +0000 (18:22 +0100)
committerChris Mason <clm@fb.com>
Fri, 31 Jan 2014 16:22:07 +0000 (08:22 -0800)
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>
cmds-send.c

index 43ea06b..3d21715 100644 (file)
@@ -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,