From d7737416f5ecdd04d999d000f0d328185d796c4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 3 Nov 2021 11:05:23 +0100 Subject: [PATCH] journald: modernize code to send notifications No change except making things a bit less verbose. --- src/journal/journald-server.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 7aa734d2d3..fc7bdb8737 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -1764,13 +1764,10 @@ static int dispatch_notify_event(sd_event_source *es, int fd, uint32_t revents, * there's something to send it will be turned on again. */ if (!s->sent_notify_ready) { - static const char p[] = - "READY=1\n" - "STATUS=Processing requests..."; - ssize_t l; + static const char p[] = "READY=1\n" + "STATUS=Processing requests..."; - l = send(s->notify_fd, p, strlen(p), MSG_DONTWAIT); - if (l < 0) { + if (send(s->notify_fd, p, strlen(p), MSG_DONTWAIT) < 0) { if (errno == EAGAIN) return 0; @@ -1781,14 +1778,9 @@ static int dispatch_notify_event(sd_event_source *es, int fd, uint32_t revents, log_debug("Sent READY=1 notification."); } else if (s->send_watchdog) { + static const char p[] = "WATCHDOG=1"; - static const char p[] = - "WATCHDOG=1"; - - ssize_t l; - - l = send(s->notify_fd, p, strlen(p), MSG_DONTWAIT); - if (l < 0) { + if (send(s->notify_fd, p, strlen(p), MSG_DONTWAIT) < 0) { if (errno == EAGAIN) return 0;