summaryrefslogtreecommitdiff
path: root/testing/util-linux/fix-remount.patch
blob: 67149ab466a4ec321d70b398add3269a29e3a671 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 277a6dd53569a409e05316a7bdaed0e78e326762 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 13 Sep 2011 22:59:39 +0200
Subject: [PATCH 2/2] mount: check for target before source on remount

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 |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/mount/fstab.c b/mount/fstab.c
index 8d88f68..77bf81c 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;
 }
 
-- 
1.7.6.1