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.
This commit is contained in:
Lennart Poettering 2020-10-26 16:31:07 +01:00
parent 2d6d4136cd
commit 3b719003c3
2 changed files with 2 additions and 7 deletions

View File

@ -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)

View File

@ -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)