]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
findmnt: test for fstype/options/maj:min before source and target
authorKarel Zak <kzak@redhat.com>
Mon, 24 Jun 2013 11:28:06 +0000 (13:28 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 24 Jun 2013 11:28:06 +0000 (13:28 +0200)
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>
misc-utils/findmnt.c

index 48c807caf375585ddbd9435cde3297099119f068..b6dbbf5d3cd823150db73a845e2c5fa39279ecc0 100644 (file)
@@ -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);