From: Theodore Ts'o Date: Sat, 3 Oct 2009 16:50:06 +0000 (-0400) Subject: lib: fix file descriptor leak in is_mounted() X-Git-Tag: v2.17-rc1~139^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fdf08588af55d07a99b411708a08f4ebe6819706;p=thirdparty%2Futil-linux.git lib: fix file descriptor leak in is_mounted() Remove an extraneous fopen() that leaks memory and a file descriptor. Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/ismounted.c b/lib/ismounted.c index 28ae32527d..fbe91f9a46 100644 --- a/lib/ismounted.c +++ b/lib/ismounted.c @@ -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) {