From 3b719003c386c8e93f31eb98b8cc5bcd6941822f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 26 Oct 2020 16:31:07 +0100 Subject: [PATCH] journald: remove pointless conditionalization Let's not have #ifdeffery both in the consumers and the providers of the selinux glue code. Unless the code is particularly complex, let's do the ifdeffery only in the provider of the selinux glue code, and let's keep the consumers simple and just invoke it. --- src/journal/journald-native.c | 2 -- src/journal/journald-syslog.c | 7 ++----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c index f2b867da3d..fed81161e0 100644 --- a/src/journal/journald-native.c +++ b/src/journal/journald-native.c @@ -483,13 +483,11 @@ int server_open_native_socket(Server *s, const char *native_socket) { if (r < 0) return log_error_errno(r, "SO_PASSCRED failed: %m"); -#if HAVE_SELINUX if (mac_selinux_use()) { r = setsockopt_int(s->native_fd, SOL_SOCKET, SO_PASSSEC, true); if (r < 0) log_warning_errno(r, "SO_PASSSEC failed: %m"); } -#endif r = setsockopt_int(s->native_fd, SOL_SOCKET, SO_TIMESTAMP, true); if (r < 0) diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c index 0da7dcfcf5..91ea41fa78 100644 --- a/src/journal/journald-syslog.c +++ b/src/journal/journald-syslog.c @@ -70,9 +70,8 @@ static void forward_syslog_iovec( msghdr.msg_controllen = cmsg->cmsg_len; } - /* Forward the syslog message we received via /dev/log to - * /run/systemd/syslog. Unfortunately we currently can't set - * the SO_TIMESTAMP auxiliary data, and hence we don't. */ + /* Forward the syslog message we received via /dev/log to /run/systemd/syslog. Unfortunately we + * currently can't set the SO_TIMESTAMP auxiliary data, and hence we don't. */ if (sendmsg(s->syslog_fd, &msghdr, MSG_NOSIGNAL) >= 0) return; @@ -484,13 +483,11 @@ int server_open_syslog_socket(Server *s, const char *syslog_socket) { if (r < 0) return log_error_errno(r, "SO_PASSCRED failed: %m"); -#if HAVE_SELINUX if (mac_selinux_use()) { r = setsockopt_int(s->syslog_fd, SOL_SOCKET, SO_PASSSEC, true); if (r < 0) log_warning_errno(r, "SO_PASSSEC failed: %m"); } -#endif r = setsockopt_int(s->syslog_fd, SOL_SOCKET, SO_TIMESTAMP, true); if (r < 0)