From: Karel Zak Date: Tue, 13 Sep 2011 20:59:39 +0000 (+0200) Subject: mount: check for target before source on remount X-Git-Tag: v2.20.1~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9e66fb3116e9cd215b3dc4eb99a648a02e35c76e;p=thirdparty%2Futil-linux.git mount: check for target before source on remount Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=737091 Reported-by: Eric Paris Signed-off-by: Karel Zak --- diff --git a/mount/fstab.c b/mount/fstab.c index 2331a7d826..fce290f7aa 100644 --- a/mount/fstab.c +++ b/mount/fstab.c @@ -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; }