]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mount: check for target before source on remount
authorKarel Zak <kzak@redhat.com>
Tue, 13 Sep 2011 20:59:39 +0000 (22:59 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 18 Oct 2011 12:22:27 +0000 (14:22 +0200)
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=737091
Reported-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
mount/fstab.c

index 2331a7d82660be992d62810b39461764773e0c92..fce290f7aa3b3c2142937d02c5c950604bd83369 100644 (file)
@@ -272,10 +272,15 @@ getmntfilebackward (const char *name, struct mntentchn *mcprev) {
        mc0 = mtab_head();
        if (!mcprev)
                mcprev = mc0;
+
        for (mc = mcprev->prev; mc && mc != mc0; mc = mc->prev)
-               if (streq(mc->m.mnt_dir, name) ||
-                   streq(mc->m.mnt_fsname, name))
+               if (streq(mc->m.mnt_dir, name))
                        return mc;
+
+       for (mc = mcprev->prev; mc && mc != mc0; mc = mc->prev)
+               if (streq(mc->m.mnt_fsname, name))
+                       return mc;
+
        return NULL;
 }