From: Zbigniew Jędrzejewski-Szmek Date: Thu, 10 Aug 2023 07:16:15 +0000 (+0200) Subject: manager: use _NEG_ macros to reduce indentation, reword comments, drop parens X-Git-Tag: v255-rc1~706^2~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=882321a13977c872b0092ecd3476bfdc2f033696;p=thirdparty%2Fsystemd.git manager: use _NEG_ macros to reduce indentation, reword comments, drop parens --- diff --git a/src/core/manager.c b/src/core/manager.c index 73c5b3109a0..53a1b41b0ed 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -2620,21 +2620,20 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t } n = recvmsg_safe(m->notify_fd, &msghdr, MSG_DONTWAIT|MSG_CMSG_CLOEXEC|MSG_TRUNC); - if (n < 0) { - if (ERRNO_IS_TRANSIENT(n)) - return 0; /* Spurious wakeup, try again */ - if (n == -EXFULL) { - log_warning("Got message with truncated control data (too many fds sent?), ignoring."); - return 0; - } - /* If this is any other, real error, then let's stop processing this socket. This of course - * means we won't take notification messages anymore, but that's still better than busy - * looping around this: being woken up over and over again but being unable to actually read - * the message off the socket. */ - return log_error_errno(n, "Failed to receive notification message: %m"); + if (ERRNO_IS_NEG_TRANSIENT(n)) + return 0; /* Spurious wakeup, try again */ + if (n == -EXFULL) { + log_warning("Got message with truncated control data (too many fds sent?), ignoring."); + return 0; } + if (n < 0) + /* If this is any other, real error, then stop processing this socket. This of course means + * we won't take notification messages anymore, but that's still better than busy looping: + * being woken up over and over again, but being unable to actually read the message from the + * socket. */ + return log_error_errno(n, "Failed to receive notification message: %m"); - CMSG_FOREACH(cmsg, &msghdr) { + CMSG_FOREACH(cmsg, &msghdr) if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) { assert(!fd_array); @@ -2648,7 +2647,6 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t assert(!ucred); ucred = CMSG_TYPED_DATA(cmsg, struct ucred); } - } if (n_fds > 0) { assert(fd_array); @@ -4719,11 +4717,10 @@ static int short_uid_range(const char *path) { * i.e. from root to nobody. */ r = uid_range_load_userns(&p, path); - if (r < 0) { - if (ERRNO_IS_NOT_SUPPORTED(r)) - return false; + if (ERRNO_IS_NEG_NOT_SUPPORTED(r)) + return false; + if (r < 0) return log_debug_errno(r, "Failed to load %s: %m", path); - } return !uid_range_covers(p, 0, 65535); }