Created
November 17, 2016 14:57
-
-
Save anonymous/317207ae499389235258f0d52ab22c03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 3ab4fbf9faa71bc414b1e86d89296b263738a9af Mon Sep 17 00:00:00 2001 | |
From: Mattias Nissler <mnissler@chromium.org> | |
Date: Thu, 17 Nov 2016 14:47:51 +0100 | |
Subject: [PATCH] mount: Add support for "nosymfollow" mount option. | |
This adds support for the "nosymfollow" mount option, which indicates | |
that symlinks should not be traversed on the mount this option is | |
applied to. | |
Signed-off-by: Mattias Nissler <mnissler@chromium.org> | |
--- | |
libmount/src/context_mount.c | 2 ++ | |
libmount/src/libmount.h.in | 3 +++ | |
libmount/src/optmap.c | 4 ++++ | |
3 files changed, 9 insertions(+) | |
diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c | |
index a7ea832..fd1f27b 100644 | |
--- a/libmount/src/context_mount.c | |
+++ b/libmount/src/context_mount.c | |
@@ -389,6 +389,8 @@ static int generate_helper_optstr(struct libmnt_context *cxt, char **optstr) | |
mnt_optstr_append_option(optstr, "suid", NULL); | |
if (!(cxt->mountflags & MS_NODEV)) | |
mnt_optstr_append_option(optstr, "dev", NULL); | |
+ if (!(cxt->mountflags & MS_NOSYMFOLLOW)) | |
+ mnt_optstr_append_option(optstr, "symfollow", NULL); | |
} | |
diff --git a/libmount/src/libmount.h.in b/libmount/src/libmount.h.in | |
index 86ff150..8008732 100644 | |
--- a/libmount/src/libmount.h.in | |
+++ b/libmount/src/libmount.h.in | |
@@ -844,6 +844,9 @@ extern int mnt_context_set_syscall_status(struct libmnt_context *cxt, int status | |
#ifndef MS_LAZYTIME | |
#define MS_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */ | |
#endif | |
+#ifndef MS_NOSYMFOLLOW | |
+#define MS_NOSYMFOLLOW (1<<26) /* Don't follow symlinks */ | |
+#endif | |
/* | |
diff --git a/libmount/src/optmap.c b/libmount/src/optmap.c | |
index f827e04..cbc382c 100644 | |
--- a/libmount/src/optmap.c | |
+++ b/libmount/src/optmap.c | |
@@ -127,6 +127,10 @@ static const struct libmnt_optmap linux_flags_map[] = | |
{ "shared", MS_SHARED, MNT_NOHLPS | MNT_NOMTAB }, /* Shared */ | |
{ "rshared", MS_SHARED | MS_REC, MNT_NOHLPS | MNT_NOMTAB }, | |
#endif | |
+#ifdef MS_NOSYMFOLLOW | |
+ { "symfollow", MS_NOSYMFOLLOW, MNT_INVERT }, /* Don't follow symlinks */ | |
+ { "nosymfollow", MS_NOSYMFOLLOW }, | |
+#endif | |
{ NULL, 0, 0 } | |
}; | |
-- | |
2.8.0.rc3.226.g39d4020 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment