5113bc
From 4b376d1ad1b46408bc59d949c277991a9b5035eb Mon Sep 17 00:00:00 2001
5113bc
From: Karel Zak <kzak@redhat.com>
5113bc
Date: Thu, 27 Oct 2016 15:30:20 +0200
5113bc
Subject: [PATCH 177/178] mount: append inverting options for mount.<type> on
5113bc
 "users"
5113bc
5113bc
If you call mount(8) as root, then we need to append inverting options
5113bc
(if specified by fstab) for "user" and "users" to /sbin/mount.<type>
5113bc
command line, because for UID=0 mount.nfs follows command line rather
5113bc
than the fstab setting.
5113bc
5113bc
This has been originally implemented by commit
5113bc
a4c0cc75ff9744299f108c259efab1bd30c8007a for the old mount(8). The
5113bc
same feature is supported by libmount, unfortunately for "user" only.
5113bc
We need the same also for "users" to be backwardly compatible.
5113bc
5113bc
Addresses: https://github.com/karelzak/util-linux/issues/368
5113bc
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1618711
5113bc
Upstream: http://github.com/karelzak/util-linux/commit/3c4a3de0fcb8f21bffacfd8bdc3d6fbd683c71f5
5113bc
Signed-off-by: Karel Zak <kzak@redhat.com>
5113bc
---
5113bc
 libmount/src/context_mount.c | 3 ++-
5113bc
 1 file changed, 2 insertions(+), 1 deletion(-)
5113bc
5113bc
diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c
5113bc
index 4df2646b0..0f4485592 100644
5113bc
--- a/libmount/src/context_mount.c
5113bc
+++ b/libmount/src/context_mount.c
5113bc
@@ -321,7 +321,8 @@ static int generate_helper_optstr(struct libmnt_context *cxt, char **optstr)
5113bc
 	if (!*optstr)
5113bc
 		return -ENOMEM;
5113bc
 
5113bc
-	if (cxt->user_mountflags & MNT_MS_USER) {
5113bc
+	if ((cxt->user_mountflags & MNT_MS_USER) ||
5113bc
+	    (cxt->user_mountflags & MNT_MS_USERS)) {
5113bc
 		/*
5113bc
 		 * This is unnecessary for real user-mounts as mount.<type>
5113bc
 		 * helpers have to always follow fstab rather than mount
5113bc
-- 
5113bc
2.14.4
5113bc