]> err.no Git - util-linux/commitdiff
lib: fix file descriptor leak in is_mounted()
authorTheodore Ts'o <tytso@mit.edu>
Sat, 3 Oct 2009 16:50:06 +0000 (12:50 -0400)
committerKarel Zak <kzak@redhat.com>
Mon, 30 Nov 2009 13:23:34 +0000 (14:23 +0100)
Remove an extraneous fopen() that leaks memory and a file descriptor.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ismounted.c

index 28ae32527d808c078011ba5080fe81319d24cea2..fbe91f9a460b62340de432562c6ac858399115cd 100644 (file)
@@ -70,9 +70,6 @@ static int check_mntent_file(const char *mtab_file, const char *file,
        char            buf[1024], *device = 0, *mnt_dir = 0, *cp;
 
        *mount_flags = 0;
-       if ((f = fopen(mtab_file, "r")) == NULL)
-               return errno;
-
        if ((f = setmntent (mtab_file, "r")) == NULL)
                return errno;
        if (stat(file, &st_buf) == 0) {