libmount: remove smackfs* option when SMACK not enabled
If there is no /sys/fs/smackfs then libmount removes smackfs*= mount options when compiled --with-smack. Note that we do the same for SELinux. References: http://www.mail-archive.com/systemd-devel@lists.freedesktop.org/msg13740.html Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
3deb67f50d
commit
b8095d25ba
|
@ -1407,6 +1407,15 @@ AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [
|
||||||
AM_CONDITIONAL([HAVE_SYSTEMD], [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != "xno" ])
|
AM_CONDITIONAL([HAVE_SYSTEMD], [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != "xno" ])
|
||||||
|
|
||||||
|
|
||||||
|
AC_ARG_WITH([smack],
|
||||||
|
AS_HELP_STRING([--with-smack], [build with SMACK support]),
|
||||||
|
[], [with_smack=no]
|
||||||
|
)
|
||||||
|
AS_IF([test "x$with_smack" = xyes], [
|
||||||
|
AC_DEFINE([HAVE_SMACK], [1], [Add SMACK support])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
AC_ARG_WITH([bashcompletiondir],
|
AC_ARG_WITH([bashcompletiondir],
|
||||||
AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
|
AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
|
||||||
[],
|
[],
|
||||||
|
|
|
@ -115,6 +115,10 @@ static int fix_optstr(struct libmnt_context *cxt)
|
||||||
#ifdef HAVE_LIBSELINUX
|
#ifdef HAVE_LIBSELINUX
|
||||||
int se_fix = 0, se_rem = 0;
|
int se_fix = 0, se_rem = 0;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_SMACK
|
||||||
|
int sm_rem = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
assert(cxt);
|
assert(cxt);
|
||||||
assert(cxt->fs);
|
assert(cxt->fs);
|
||||||
assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED));
|
assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED));
|
||||||
|
@ -205,6 +209,10 @@ static int fix_optstr(struct libmnt_context *cxt)
|
||||||
mnt_optstr_deduplicate_option(&fs->fs_optstr, "rootcontext");
|
mnt_optstr_deduplicate_option(&fs->fs_optstr, "rootcontext");
|
||||||
mnt_optstr_deduplicate_option(&fs->fs_optstr, "seclabel");
|
mnt_optstr_deduplicate_option(&fs->fs_optstr, "seclabel");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SMACK
|
||||||
|
if (access("sys/fs/smackfs", F_OK) != 0)
|
||||||
|
sm_rem = 1;
|
||||||
#endif
|
#endif
|
||||||
while (!mnt_optstr_next_option(&next, &name, &namesz, &val, &valsz)) {
|
while (!mnt_optstr_next_option(&next, &name, &namesz, &val, &valsz)) {
|
||||||
|
|
||||||
|
@ -231,6 +239,20 @@ static int fix_optstr(struct libmnt_context *cxt)
|
||||||
rc = mnt_optstr_fix_secontext(&fs->fs_optstr,
|
rc = mnt_optstr_fix_secontext(&fs->fs_optstr,
|
||||||
val, valsz, &next);
|
val, valsz, &next);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SMACK
|
||||||
|
else if (sm_rem && namesz >= 10
|
||||||
|
&& (!strncmp(name, "smackfsdef", 10) ||
|
||||||
|
!strncmp(name, "smackfsfloor", 12) ||
|
||||||
|
!strncmp(name, "smackfshat", 10) ||
|
||||||
|
!strncmp(name, "smackfsroot", 11) ||
|
||||||
|
!strncmp(name, "smackfstransmute", 16))) {
|
||||||
|
|
||||||
|
next = name;
|
||||||
|
rc = mnt_optstr_remove_option_at(&fs->fs_optstr,
|
||||||
|
name,
|
||||||
|
val ? val + valsz : name + namesz);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (rc)
|
if (rc)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
Loading…
Reference in New Issue