From: Karel Zak Date: Wed, 1 Aug 2012 15:52:22 +0000 (+0200) Subject: libmount: deduplicate SELinux mount options X-Git-Tag: v2.22-rc2~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1f9a46abd47ff7c681fd22ecf81a31260498f2c;p=thirdparty%2Futil-linux.git libmount: deduplicate SELinux mount options We already have a clue about SELinux specific mount options in libmount, so it makes sense to deduplicate the options as Linux kernel does not support duplicate SELinux options. (SELinux kernel stuff somehow ignores standard Linux mount conventions...) Requested-by: Niels de Vos Signed-off-by: Karel Zak --- diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index 36dc414aea..f3d8ff103b 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -117,6 +117,15 @@ static int fix_optstr(struct libmnt_context *cxt) else /* For normal mount we have translate the contexts */ se_fix = 1; + + if (!se_rem) { + /* de-duplicate SELinux options */ + mnt_optstr_deduplicate_option(&fs->fs_optstr, "context"); + mnt_optstr_deduplicate_option(&fs->fs_optstr, "fscontext"); + mnt_optstr_deduplicate_option(&fs->fs_optstr, "defcontext"); + mnt_optstr_deduplicate_option(&fs->fs_optstr, "rootcontext"); + mnt_optstr_deduplicate_option(&fs->fs_optstr, "seclabel"); + } #endif while (!mnt_optstr_next_option(&next, &name, &namesz, &val, &valsz)) {