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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-11-03 11:29:49 +01:00
parent 9214f2999b
commit 4bf4f50faa
8 changed files with 71 additions and 46 deletions
+4 -1
View File
@@ -317,7 +317,10 @@ static int run(int argc, char *argv[]) {
if (!ready) {
/* Notify manager that we are now finished with processing whatever was
* queued */
(void) sd_notify(false, "READY=1");
r = sd_notify(false, "READY=1");
if (r < 0)
log_warning_errno(r, "Failed to send readiness notification, ignoring: %m");
ready = true;
}