summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-10-03 10:41:51 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-10-04 12:09:29 +0200
commit349cc4a507c4d84fcadf61f42159ea6412717896 (patch)
tree8d6e64af681fb4e1e41a1fc01b4f225f56aa147d /src/core
parentaf8786b16a39fbc92818444aac156ccbb030018c (diff)
downloadsystemd-349cc4a507c4d84fcadf61f42159ea6412717896.tar.gz
build-sys: use #if Y instead of #ifdef Y everywhere
The advantage is that is the name is mispellt, cpp will warn us. $ git grep -Ee "conf.set\('(HAVE|ENABLE)_" -l|xargs sed -r -i "s/conf.set\('(HAVE|ENABLE)_/conf.set10('\1_/" $ git grep -Ee '#ifn?def (HAVE|ENABLE)' -l|xargs sed -r -i 's/#ifdef (HAVE|ENABLE)/#if \1/; s/#ifndef (HAVE|ENABLE)/#if ! \1/;' $ git grep -Ee 'if.*defined\(HAVE' -l|xargs sed -i -r 's/defined\((HAVE_[A-Z0-9_]*)\)/\1/g' $ git grep -Ee 'if.*defined\(ENABLE' -l|xargs sed -i -r 's/defined\((ENABLE_[A-Z0-9_]*)\)/\1/g' + manual changes to meson.build squash! build-sys: use #if Y instead of #ifdef Y everywhere v2: - fix incorrect setting of HAVE_LIBIDN2
Diffstat (limited to 'src/core')
-rw-r--r--src/core/audit-fd.c2
-rw-r--r--src/core/dbus-execute.c14
-rw-r--r--src/core/dbus.c4
-rw-r--r--src/core/execute.c48
-rw-r--r--src/core/ima-setup.c2
-rw-r--r--src/core/kmod-setup.c8
-rw-r--r--src/core/load-fragment.c16
-rw-r--r--src/core/main.c14
-rw-r--r--src/core/manager.c6
-rw-r--r--src/core/mount-setup.c12
-rw-r--r--src/core/namespace.c2
-rw-r--r--src/core/selinux-access.c6
-rw-r--r--src/core/selinux-access.h2
-rw-r--r--src/core/selinux-setup.c6
-rw-r--r--src/core/smack-setup.c4
-rw-r--r--src/core/umount.c2
16 files changed, 74 insertions, 74 deletions
diff --git a/src/core/audit-fd.c b/src/core/audit-fd.c
index bc421a4343..6207f8185e 100644
--- a/src/core/audit-fd.c
+++ b/src/core/audit-fd.c
@@ -22,7 +22,7 @@
#include "audit-fd.h"
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
#include <libaudit.h>
#include <stdbool.h>
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index 1a388f5592..e0aa9fdd82 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -19,7 +19,7 @@
#include <sys/prctl.h>
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include <seccomp.h>
#endif
@@ -42,7 +42,7 @@
#include "path-util.h"
#include "process-util.h"
#include "rlimit-util.h"
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include "seccomp-util.h"
#endif
#include "securebits-util.h"
@@ -376,7 +376,7 @@ static int property_get_syscall_filter(
_cleanup_strv_free_ char **l = NULL;
int r;
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
Iterator i;
void *id;
#endif
@@ -393,7 +393,7 @@ static int property_get_syscall_filter(
if (r < 0)
return r;
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
SET_FOREACH(id, c->syscall_filter, i) {
char *name;
@@ -429,7 +429,7 @@ static int property_get_syscall_archs(
_cleanup_strv_free_ char **l = NULL;
int r;
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
Iterator i;
void *id;
#endif
@@ -438,7 +438,7 @@ static int property_get_syscall_archs(
assert(reply);
assert(c);
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
SET_FOREACH(id, c->syscall_archs, i) {
const char *name;
@@ -1185,7 +1185,7 @@ int bus_exec_context_set_transient_property(
return 1;
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
} else if (streq(name, "SystemCallFilter")) {
int whitelist;
diff --git a/src/core/dbus.c b/src/core/dbus.c
index 6d3f714192..210b344cd3 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -211,7 +211,7 @@ failed:
return 0;
}
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
static int mac_selinux_filter(sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
const char *verb, *path;
@@ -535,7 +535,7 @@ static int bus_setup_api_vtables(Manager *m, sd_bus *bus) {
assert(m);
assert(bus);
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
r = sd_bus_add_filter(bus, NULL, mac_selinux_filter, m);
if (r < 0)
return log_error_errno(r, "Failed to add SELinux access filter: %m");
diff --git a/src/core/execute.c b/src/core/execute.c
index e1c2a57cc6..2271a2876a 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -37,19 +37,19 @@
#include <unistd.h>
#include <utmpx.h>
-#ifdef HAVE_PAM
+#if HAVE_PAM
#include <security/pam_appl.h>
#endif
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <selinux/selinux.h>
#endif
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include <seccomp.h>
#endif
-#ifdef HAVE_APPARMOR
+#if HAVE_APPARMOR
#include <sys/apparmor.h>
#endif
@@ -57,7 +57,7 @@
#include "af-list.h"
#include "alloc-util.h"
-#ifdef HAVE_APPARMOR
+#if HAVE_APPARMOR
#include "apparmor-util.h"
#endif
#include "async.h"
@@ -88,7 +88,7 @@
#include "process-util.h"
#include "rlimit-util.h"
#include "rm-rf.h"
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include "seccomp-util.h"
#endif
#include "securebits.h"
@@ -1019,7 +1019,7 @@ static int enforce_user(const ExecContext *context, uid_t uid) {
return 0;
}
-#ifdef HAVE_PAM
+#if HAVE_PAM
static int null_conv(
int num_msg,
@@ -1043,7 +1043,7 @@ static int setup_pam(
char ***env,
int fds[], unsigned n_fds) {
-#ifdef HAVE_PAM
+#if HAVE_PAM
static const struct pam_conv conv = {
.conv = null_conv,
@@ -1318,7 +1318,7 @@ static bool context_has_no_new_privileges(const ExecContext *c) {
c->lock_personality;
}
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
static bool skip_seccomp_unavailable(const Unit* u, const char* msg) {
@@ -2688,13 +2688,13 @@ static int exec_child(
needs_setuid, /* Do we need to do the actual setresuid()/setresgid() calls? */
needs_mount_namespace, /* Do we need to set up a mount namespace for this kernel? */
needs_ambient_hack; /* Do we need to apply the ambient capabilities hack? */
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
bool use_selinux = false;
#endif
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
bool use_smack = false;
#endif
-#ifdef HAVE_APPARMOR
+#if HAVE_APPARMOR
bool use_apparmor = false;
#endif
uid_t uid = UID_INVALID;
@@ -3048,13 +3048,13 @@ static int exec_child(
* present. The actual MAC context application will happen later, as late as possible, to avoid
* impacting our own code paths. */
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
use_selinux = mac_selinux_use();
#endif
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
use_smack = mac_smack_use();
#endif
-#ifdef HAVE_APPARMOR
+#if HAVE_APPARMOR
use_apparmor = mac_apparmor_use();
#endif
}
@@ -3101,7 +3101,7 @@ static int exec_child(
}
if (needs_sandboxing) {
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
if (use_selinux && params->selinux_context_net && socket_fd >= 0) {
r = mac_selinux_get_child_mls_label(socket_fd, command->path, context->selinux_context, &mac_selinux_context_net);
if (r < 0) {
@@ -3223,7 +3223,7 @@ static int exec_child(
* syscalls that are subject to seccomp filtering, hence should probably be applied before the syscalls
* are restricted. */
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
if (use_selinux) {
char *exec_context = mac_selinux_context_net ?: context->selinux_context;
@@ -3237,7 +3237,7 @@ static int exec_child(
}
#endif
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
if (use_smack) {
r = setup_smack(context, command);
if (r < 0) {
@@ -3247,7 +3247,7 @@ static int exec_child(
}
#endif
-#ifdef HAVE_APPARMOR
+#if HAVE_APPARMOR
if (use_apparmor && context->apparmor_profile) {
r = aa_change_onexec(context->apparmor_profile);
if (r < 0 && !context->apparmor_profile_ignore) {
@@ -3271,7 +3271,7 @@ static int exec_child(
return log_unit_error_errno(unit, errno, "Failed to disable new privileges: %m");
}
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
r = apply_address_families(unit, context);
if (r < 0) {
*exit_status = EXIT_ADDRESS_FAMILIES;
@@ -4118,7 +4118,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
prefix, yes_no(c->lock_personality));
if (c->syscall_filter) {
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
Iterator j;
void *id;
bool first = true;
@@ -4131,7 +4131,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
if (!c->syscall_whitelist)
fputc('~', f);
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
SET_FOREACH(id, c->syscall_filter, j) {
_cleanup_free_ char *name = NULL;
@@ -4149,7 +4149,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
}
if (c->syscall_archs) {
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
Iterator j;
void *id;
#endif
@@ -4158,7 +4158,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
"%sSystemCallArchitectures:",
prefix);
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
SET_FOREACH(id, c->syscall_archs, j)
fprintf(f, " %s", strna(seccomp_arch_to_string(PTR_TO_UINT32(id) - 1)));
#endif
diff --git a/src/core/ima-setup.c b/src/core/ima-setup.c
index 7b5c98a57c..1aaae9f49e 100644
--- a/src/core/ima-setup.c
+++ b/src/core/ima-setup.c
@@ -33,7 +33,7 @@
#define IMA_POLICY_PATH "/etc/ima/ima-policy"
int ima_setup(void) {
-#ifdef HAVE_IMA
+#if HAVE_IMA
_cleanup_fclose_ FILE *input = NULL;
_cleanup_close_ int imafd = -1;
unsigned lineno = 0;
diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
index 30b42fffe5..066b959770 100644
--- a/src/core/kmod-setup.c
+++ b/src/core/kmod-setup.c
@@ -21,7 +21,7 @@
#include <string.h>
#include <unistd.h>
-#ifdef HAVE_KMOD
+#if HAVE_KMOD
#include <libkmod.h>
#endif
@@ -33,7 +33,7 @@
#include "macro.h"
#include "string-util.h"
-#ifdef HAVE_KMOD
+#if HAVE_KMOD
static void systemd_kmod_log(
void *data,
int priority,
@@ -85,7 +85,7 @@ static bool has_virtio_rng(void) {
#endif
int kmod_setup(void) {
-#ifdef HAVE_KMOD
+#if HAVE_KMOD
static const struct {
const char *module;
@@ -103,7 +103,7 @@ int kmod_setup(void) {
/* this should never be a module */
{ "unix", "/proc/net/unix", true, true, NULL },
-#ifdef HAVE_LIBIPTC
+#if HAVE_LIBIPTC
/* netfilter is needed by networkd, nspawn among others, and cannot be autoloaded */
{ "ip_tables", "/proc/net/ip_tables_names", false, false, NULL },
#endif
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 2c3783a9f0..04170695c5 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -22,7 +22,7 @@
#include <fcntl.h>
#include <linux/fs.h>
#include <linux/oom.h>
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include <seccomp.h>
#endif
#include <sched.h>
@@ -54,7 +54,7 @@
#include "path-util.h"
#include "process-util.h"
#include "rlimit-util.h"
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include "seccomp-util.h"
#endif
#include "securebits.h"
@@ -1246,7 +1246,7 @@ int config_parse_limit(
return 0;
}
-#ifdef HAVE_SYSV_COMPAT
+#if HAVE_SYSV_COMPAT
int config_parse_sysv_priority(const char *unit,
const char *filename,
unsigned line,
@@ -2643,7 +2643,7 @@ int config_parse_documentation(const char *unit,
return r;
}
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
static int syscall_filter_parse_one(
const char *unit,
@@ -4504,7 +4504,7 @@ void unit_dump_config_items(FILE *f) {
const ConfigParserCallback callback;
const char *rvalue;
} table[] = {
-#if !defined(HAVE_SYSV_COMPAT) || !defined(HAVE_SECCOMP) || !defined(HAVE_PAM) || !defined(HAVE_SELINUX) || !defined(HAVE_SMACK) || !defined(HAVE_APPARMOR)
+#if !HAVE_SYSV_COMPAT || !HAVE_SECCOMP || !HAVE_PAM || !HAVE_SELINUX || !HAVE_SMACK || !HAVE_APPARMOR
{ config_parse_warn_compat, "NOTSUPPORTED" },
#endif
{ config_parse_int, "INTEGER" },
@@ -4537,7 +4537,7 @@ void unit_dump_config_items(FILE *f) {
{ config_parse_exec, "PATH [ARGUMENT [...]]" },
{ config_parse_service_type, "SERVICETYPE" },
{ config_parse_service_restart, "SERVICERESTART" },
-#ifdef HAVE_SYSV_COMPAT
+#if HAVE_SYSV_COMPAT
{ config_parse_sysv_priority, "SYSVPRIORITY" },
#endif
{ config_parse_kill_mode, "KILLMODE" },
@@ -4567,7 +4567,7 @@ void unit_dump_config_items(FILE *f) {
{ config_parse_set_status, "STATUS" },
{ config_parse_service_sockets, "SOCKETS" },
{ config_parse_environ, "ENVIRON" },
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
{ config_parse_syscall_filter, "SYSCALLS" },
{ config_parse_syscall_archs, "ARCHS" },
{ config_parse_syscall_errno, "ERRNO" },
@@ -4587,7 +4587,7 @@ void unit_dump_config_items(FILE *f) {
{ config_parse_blockio_device_weight, "DEVICEWEIGHT" },
{ config_parse_long, "LONG" },
{ config_parse_socket_service, "SERVICE" },
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
{ config_parse_exec_selinux_context, "LABEL" },
#endif
{ config_parse_job_mode, "MODE" },
diff --git a/src/core/main.c b/src/core/main.c
index 2dfd48005b..60863d2eed 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -28,10 +28,10 @@
#include <sys/reboot.h>
#include <sys/stat.h>
#include <unistd.h>
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include <seccomp.h>
#endif
-#ifdef HAVE_VALGRIND_VALGRIND_H
+#if HAVE_VALGRIND_VALGRIND_H
#include <valgrind/valgrind.h>
#endif
@@ -74,7 +74,7 @@
#include "process-util.h"
#include "raw-clone.h"
#include "rlimit-util.h"
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include "seccomp-util.h"
#endif
#include "selinux-setup.h"
@@ -717,7 +717,7 @@ static int parse_config_file(void) {
{ "Manager", "RuntimeWatchdogSec", config_parse_sec, 0, &arg_runtime_watchdog },
{ "Manager", "ShutdownWatchdogSec", config_parse_sec, 0, &arg_shutdown_watchdog },
{ "Manager", "CapabilityBoundingSet", config_parse_capability_set, 0, &arg_capability_bounding_set },
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
{ "Manager", "SystemCallArchitectures", config_parse_syscall_archs, 0, &arg_syscall_archs },
#endif
{ "Manager", "TimerSlackNSec", config_parse_nsec, 0, &arg_timer_slack_nsec },
@@ -1264,7 +1264,7 @@ oom:
}
static int enforce_syscall_archs(Set *archs) {
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
int r;
if (!is_seccomp_available())
@@ -1411,7 +1411,7 @@ int main(int argc, char *argv[]) {
struct rlimit saved_rlimit_nofile = RLIMIT_MAKE_CONST(0), saved_rlimit_memlock = RLIMIT_MAKE_CONST((rlim_t) -1);
const char *error_message = NULL;
-#ifdef HAVE_SYSV_COMPAT
+#if HAVE_SYSV_COMPAT
if (getpid_cached() != 1 && strstr(program_invocation_short_name, "init")) {
/* This is compatibility support for SysV, where
* calling init as a user is identical to telinit. */
@@ -2172,7 +2172,7 @@ finish:
arg_serialization = safe_fclose(arg_serialization);
fds = fdset_free(fds);
-#ifdef HAVE_VALGRIND_VALGRIND_H
+#if HAVE_VALGRIND_VALGRIND_H
/* If we are PID 1 and running under valgrind, then let's exit
* here explicitly. valgrind will only generate nice output on
* exit(), not on exec(), hence let's do the former not the
diff --git a/src/core/manager.c b/src/core/manager.c
index 5c127e0848..a0d3c85ff1 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -30,7 +30,7 @@
#include <sys/wait.h>
#include <unistd.h>
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
#include <libaudit.h>
#endif
@@ -620,7 +620,7 @@ int manager_new(UnitFileScope scope, unsigned test_run_flags, Manager **_m) {
m->default_timeout_stop_usec = DEFAULT_TIMEOUT_USEC;
m->default_restart_usec = DEFAULT_RESTART_USEC;
-#ifdef ENABLE_EFI
+#if ENABLE_EFI
if (MANAGER_IS_SYSTEM(m) && detect_container() <= 0)
boot_timestamps(&m->userspace_timestamp, &m->firmware_timestamp, &m->loader_timestamp);
#endif
@@ -2457,7 +2457,7 @@ int manager_get_job_from_dbus_path(Manager *m, const char *s, Job **_j) {
void manager_send_unit_audit(Manager *m, Unit *u, int type, bool success) {
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
_cleanup_free_ char *p = NULL;
const char *msg;
int audit_fd, r;
diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c
index b343bb7e09..676c82dcc9 100644
--- a/src/core/mount-setup.c
+++ b/src/core/mount-setup.c
@@ -64,7 +64,7 @@ typedef struct MountPoint {
* fourth (securityfs) is needed by IMA to load a custom policy. The
* other ones we can delay until SELinux and IMA are loaded. When
* SMACK is enabled we need smackfs, too, so it's a fifth one. */
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
#define N_EARLY_MOUNT 5
#else
#define N_EARLY_MOUNT 4
@@ -79,7 +79,7 @@ static const MountPoint mount_table[] = {
NULL, MNT_FATAL|MNT_IN_CONTAINER },
{ "securityfs", "/sys/kernel/security", "securityfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
NULL, MNT_NONE },
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
{ "smackfs", "/sys/fs/smackfs", "smackfs", "smackfsdef=*", MS_NOSUID|MS_NOEXEC|MS_NODEV,
mac_smack_use, MNT_FATAL },
{ "tmpfs", "/dev/shm", "tmpfs", "mode=1777,smackfsroot=*", MS_NOSUID|MS_NODEV|MS_STRICTATIME,
@@ -89,7 +89,7 @@ static const MountPoint mount_table[] = {
NULL, MNT_FATAL|MNT_IN_CONTAINER },
{ "devpts", "/dev/pts", "devpts", "mode=620,gid=" STRINGIFY(TTY_GID), MS_NOSUID|MS_NOEXEC,
NULL, MNT_IN_CONTAINER },
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
{ "tmpfs", "/run", "tmpfs", "mode=755,smackfsroot=*", MS_NOSUID|MS_NODEV|MS_STRICTATIME,
mac_smack_use, MNT_FATAL },
#endif
@@ -111,7 +111,7 @@ static const MountPoint mount_table[] = {
cg_is_legacy_wanted, MNT_FATAL|MNT_IN_CONTAINER },
{ "pstore", "/sys/fs/pstore", "pstore", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
NULL, MNT_NONE },
-#ifdef ENABLE_EFI
+#if ENABLE_EFI
{ "efivarfs", "/sys/firmware/efi/efivars", "efivarfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
is_efi_boot, MNT_NONE },
#endif
@@ -336,7 +336,7 @@ int mount_cgroup_controllers(char ***join_controllers) {
return 0;
}
-#if defined(HAVE_SELINUX) || defined(HAVE_SMACK)
+#if HAVE_SELINUX || HAVE_SMACK
static int nftw_cb(
const char *fpath,
const struct stat *sb,
@@ -367,7 +367,7 @@ int mount_setup(bool loaded_policy) {
if (r < 0)
return r;
-#if defined(HAVE_SELINUX) || defined(HAVE_SMACK)
+#if HAVE_SELINUX || HAVE_SMACK
/* Nodes in devtmpfs and /run need to be manually updated for
* the appropriate labels, after mounting. The other virtual
* API file systems like /sys and /proc do not need that, they
diff --git a/src/core/namespace.c b/src/core/namespace.c
index 932fbe5c54..6d74b8da67 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -107,7 +107,7 @@ static const MountEntry protect_kernel_tunables_table[] = {
/* ProtectKernelModules= option */
static const MountEntry protect_kernel_modules_table[] = {
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
{ "/lib/modules", INACCESSIBLE, true },
#endif
{ "/usr/lib/modules", INACCESSIBLE, true },
diff --git a/src/core/selinux-access.c b/src/core/selinux-access.c
index 0f8a2d68e2..2db4189401 100644
--- a/src/core/selinux-access.c
+++ b/src/core/selinux-access.c
@@ -19,13 +19,13 @@
#include "selinux-access.h"
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <errno.h>
#include <selinux/avc.h>
#include <selinux/selinux.h>
#include <stdio.h>
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
#include <libaudit.h>
#endif
@@ -112,7 +112,7 @@ _printf_(2, 3) static int log_callback(int type, const char *fmt, ...) {
va_list ap;
const char *fmt2;
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
int fd;
fd = get_audit_fd();
diff --git a/src/core/selinux-access.h b/src/core/selinux-access.h
index f46370d020..1f6a518a61 100644
--- a/src/core/selinux-access.h
+++ b/src/core/selinux-access.h
@@ -26,7 +26,7 @@
int mac_selinux_generic_access_check(sd_bus_message *message, const char *path, const char *permission, sd_bus_error *error);
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#define mac_selinux_access_check(message, permission, error) \
mac_selinux_generic_access_check((message), NULL, (permission), (error))
diff --git a/src/core/selinux-setup.c b/src/core/selinux-setup.c
index 527aa8add0..60361a5638 100644
--- a/src/core/selinux-setup.c
+++ b/src/core/selinux-setup.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <unistd.h>
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <selinux/selinux.h>
#endif
@@ -32,7 +32,7 @@
#include "string-util.h"
#include "util.h"
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
_printf_(2,3)
static int null_log(int type, const char *fmt, ...) {
return 0;
@@ -41,7 +41,7 @@ static int null_log(int type, const char *fmt, ...) {
int mac_selinux_setup(bool *loaded_policy) {
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
int enforce = 0;
usec_t before_load, after_load;
char *con;
diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
index 9f25364335..be32c43423 100644
--- a/src/core/smack-setup.c
+++ b/src/core/smack-setup.c
@@ -36,7 +36,7 @@
#include "string-util.h"
#include "util.h"
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
static int write_access2_rules(const char* srcdir) {
_cleanup_close_ int load2_fd = -1, change_fd = -1;
@@ -316,7 +316,7 @@ static int write_onlycap_list(void) {
int mac_smack_setup(bool *loaded_policy) {
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
int r;
diff --git a/src/core/umount.c b/src/core/umount.c
index 7e9ea20388..813d257139 100644
--- a/src/core/umount.c
+++ b/src/core/umount.c
@@ -375,7 +375,7 @@ static int delete_dm(dev_t devnum) {
static bool nonunmountable_path(const char *path) {
return path_equal(path, "/")
-#ifndef HAVE_SPLIT_USR
+#if ! HAVE_SPLIT_USR
|| path_equal(path, "/usr")
#endif
|| path_startswith(path, "/run/initramfs");