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" <tytso@mit.edu>
This commit is contained in:
parent
741064af10
commit
fdf08588af
|
@ -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;
|
char buf[1024], *device = 0, *mnt_dir = 0, *cp;
|
||||||
|
|
||||||
*mount_flags = 0;
|
*mount_flags = 0;
|
||||||
if ((f = fopen(mtab_file, "r")) == NULL)
|
|
||||||
return errno;
|
|
||||||
|
|
||||||
if ((f = setmntent (mtab_file, "r")) == NULL)
|
if ((f = setmntent (mtab_file, "r")) == NULL)
|
||||||
return errno;
|
return errno;
|
||||||
if (stat(file, &st_buf) == 0) {
|
if (stat(file, &st_buf) == 0) {
|
||||||
|
|
Loading…
Reference in New Issue