summaryrefslogtreecommitdiffstats
path: root/misc-utils/findmnt.c
diff options
context:
space:
mode:
authorKarel Zak2013-06-24 13:28:06 +0200
committerKarel Zak2013-06-24 13:28:06 +0200
commit4096946f3b4c502345ff40d22139a0c5b7e11d52 (patch)
treefadc165a4cf1b0897111656c58eda901275edba4 /misc-utils/findmnt.c
parenteject: Check host_status and driver_status when using SG_IO. (diff)
downloadkernel-qcow2-util-linux-4096946f3b4c502345ff40d22139a0c5b7e11d52.tar.gz
kernel-qcow2-util-linux-4096946f3b4c502345ff40d22139a0c5b7e11d52.tar.xz
kernel-qcow2-util-linux-4096946f3b4c502345ff40d22139a0c5b7e11d52.zip
findmnt: test for fstype/options/maj:min before source and target
This change allows to exclude for example NFS mountpoint: findmnt --fstab --target /mnt/foo --type nonfs to stall on a stalled nfs mount. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/findmnt.c')
-rw-r--r--misc-utils/findmnt.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
index 48c807caf..b6dbbf5d3 100644
--- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -831,14 +831,6 @@ static int match_func(struct libmnt_fs *fs,
const char *m;
void *md;
- m = get_match(COL_TARGET);
- if (m && !mnt_fs_match_target(fs, m, cache))
- return rc;
-
- m = get_match(COL_SOURCE);
- if (m && !mnt_fs_match_source(fs, m, cache))
- return rc;
-
m = get_match(COL_FSTYPE);
if (m && !mnt_fs_match_fstype(fs, m))
return rc;
@@ -851,6 +843,14 @@ static int match_func(struct libmnt_fs *fs,
if (md && mnt_fs_get_devno(fs) != *((dev_t *) md))
return rc;
+ m = get_match(COL_TARGET);
+ if (m && !mnt_fs_match_target(fs, m, cache))
+ return rc;
+
+ m = get_match(COL_SOURCE);
+ if (m && !mnt_fs_match_source(fs, m, cache))
+ return rc;
+
if ((flags & FL_DF) && !(flags & FL_ALL)) {
const char *type = mnt_fs_get_fstype(fs);