diff options
author | Theodore Ts'o <tytso@mit.edu> | 2020-01-06 14:42:01 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2020-01-06 15:15:10 -0500 |
commit | 43bdb47d02b17d46e8495dae733c7b07cb9f9ce4 (patch) | |
tree | c73322810315313c422d7eaef28d789ea1a72a32 | |
parent | c52d930f3ffbc19fa248d53daa171436ac391bb5 (diff) | |
download | e2fsprogs-43bdb47d02b17d46e8495dae733c7b07cb9f9ce4.tar.gz |
libext2fs: don't scan /etc/mtab if file system not found in /proc/mounts
Previously we would scan /etc/mtab if the device is not found in
/proc/mounts. This is because previously, /etc/mtab would have the
filename for a loopback mount, while /proc/mounts would only have
something like /dev/loop0. Since on many systems /etc/mtab is now a
symlink to /proc/mounts, ismounted.c has a special function,
check_loop_mounted.
For this reason, it's not necessary to fall back to trying to scan
/etc/mtab if a device / filename is not found from scanning
/proc/mounts. This also prevents failures if the file /etc/mtab does
not exist but /proc/mounts does exist when checking to see if a device
is mounted when it isn't.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | lib/ext2fs/ismounted.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ext2fs/ismounted.c b/lib/ext2fs/ismounted.c index dc37cce4c..c02156925 100644 --- a/lib/ext2fs/ismounted.c +++ b/lib/ext2fs/ismounted.c @@ -227,7 +227,7 @@ static errcode_t check_mntent(const char *file, int *mount_flags, #ifdef __linux__ retval = check_mntent_file("/proc/mounts", file, mount_flags, mtpt, mtlen); - if (retval == 0 && (*mount_flags != 0)) + if (retval == 0) return 0; #endif /* __linux__ */ #if defined(MOUNTED) || defined(_PATH_MOUNTED) |