diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-11-03 11:04:46 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-11-03 11:29:49 +0100 |
commit | 4bf4f50faabd9014720e3e499801d4cdb1e32f6d (patch) | |
tree | 4d5b6fb1fa9d903c63653c879c003698a66ff597 /src/portable/portabled.c | |
parent | 9214f2999b85533ad184e6508f0a0a078d9d3b8f (diff) | |
download | systemd-4bf4f50faabd9014720e3e499801d4cdb1e32f6d.tar.gz |
tree-wide: warn when sd_notify fails with READY=1 or FDSTOREREMOVE=1
Most sd_notify() calls are like log_info() — the result is only informative
and if they fail, it's best ignore this. But if a call with READY=1 fails,
the unit may enter a failed state, so we should warn about this. Similarly
for FSTOREREMOVE=1: the manager may be left with a stale fd, at least wasting
resources.
Diffstat (limited to 'src/portable/portabled.c')
-rw-r--r-- | src/portable/portabled.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/portable/portabled.c b/src/portable/portabled.c index 3c8e20e0f3..2f9afdc8f2 100644 --- a/src/portable/portabled.c +++ b/src/portable/portabled.c @@ -4,11 +4,11 @@ #include <sys/types.h> #include "sd-bus.h" -#include "sd-daemon.h" #include "alloc-util.h" #include "bus-log-control-api.h" #include "bus-polkit.h" +#include "daemon-util.h" #include "def.h" #include "main-func.h" #include "portabled-bus.h" @@ -154,15 +154,13 @@ static int run(int argc, char *argv[]) { return log_error_errno(r, "Failed to fully start up daemon: %m"); log_debug("systemd-portabled running as pid " PID_FMT, getpid_cached()); - sd_notify(false, - "READY=1\n" - "STATUS=Processing requests..."); + r = sd_notify(false, NOTIFY_READY); + if (r < 0) + log_warning_errno(r, "Failed to send readiness notification, ignoring: %m"); r = manager_run(m); - (void) sd_notify(false, - "STOPPING=1\n" - "STATUS=Shutting down..."); + (void) sd_notify(false, NOTIFY_STOPPING); log_debug("systemd-portabled stopped as pid " PID_FMT, getpid_cached()); return r; } |