summaryrefslogtreecommitdiffstats
path: root/src/rfkill
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-11-03 11:04:46 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-11-03 11:29:49 +0100
commit4bf4f50faabd9014720e3e499801d4cdb1e32f6d (patch)
tree4d5b6fb1fa9d903c63653c879c003698a66ff597 /src/rfkill
parentCODING_STYLE: allow joined variable declarations and function calls (diff)
downloadsystemd-4bf4f50faabd9014720e3e499801d4cdb1e32f6d.tar.xz
systemd-4bf4f50faabd9014720e3e499801d4cdb1e32f6d.zip
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/rfkill')
-rw-r--r--src/rfkill/rfkill.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/rfkill/rfkill.c b/src/rfkill/rfkill.c
index bff1a2886b..bca2f3b812 100644
--- a/src/rfkill/rfkill.c
+++ b/src/rfkill/rfkill.c
@@ -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;
}