diff --git a/meson.build b/meson.build index 8261b13155..fe6b26b835 100644 --- a/meson.build +++ b/meson.build @@ -1024,8 +1024,11 @@ else endif conf.set10('HAVE_APPARMOR', have) -conf.set10('HAVE_SMACK_RUN_LABEL', get_option('smack-run-label') != '') -conf.set_quoted('SMACK_RUN_LABEL', get_option('smack-run-label')) +have = get_option('smack') and get_option('smack-run-label') != '' +conf.set10('HAVE_SMACK_RUN_LABEL', have) +if have + conf.set_quoted('SMACK_RUN_LABEL', get_option('smack-run-label')) +endif want_polkit = get_option('polkit') install_polkit = false diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c index 79c4808473..5b2671ff40 100644 --- a/src/core/smack-setup.c +++ b/src/core/smack-setup.c @@ -322,7 +322,7 @@ int mac_smack_setup(bool *loaded_policy) { return 0; } -#ifdef SMACK_RUN_LABEL +#if HAVE_SMACK_RUN_LABEL r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); if (r < 0) log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m"); diff --git a/src/shared/mount-setup.c b/src/shared/mount-setup.c index 0f2fb5d098..ae148541d7 100644 --- a/src/shared/mount-setup.c +++ b/src/shared/mount-setup.c @@ -278,7 +278,7 @@ static int symlink_controller(const char *target, const char *alias) { if (r < 0) return log_error_errno(r, "Failed to create symlink %s: %m", a); -#ifdef SMACK_RUN_LABEL +#if HAVE_SMACK_RUN_LABEL const char *p; p = strjoina("/sys/fs/cgroup/", target);