summaryrefslogtreecommitdiff
path: root/src/notify
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-05-03 14:14:06 +0200
committerLennart Poettering <lennart@poettering.net>2023-05-03 18:03:05 +0200
commit09e766e70b7d8a187c210a6e1892f825aa282299 (patch)
treef541102523a3f4dfecf7d5c84bd3b73f8fd9f22c /src/notify
parentc4039ceb9e063d72f6afb7bc05d583de55966718 (diff)
downloadsystemd-09e766e70b7d8a187c210a6e1892f825aa282299.tar.gz
notify: don't send EXIT_STATUS= notify message from systemd-notify
In 623a00020f116d8e9c70608a9e4f7cc978342441 code was added that our various programs send a notification message with their exit status on exit. This is great, but it becomes utterly confusing in systemd-notify, whose primary purpose is to send such messages after all, and sending an implicit one in addition to the primary one is particularly confusing, when debugging things. Let's hence just drop the implicit message. systemd-notify's exit status is after all indicative primarily because sd_notify() failed, and hence it's pretty pointless to then send that fact as another sd_notify() message. (Primary reason for this patch is simply that it confused the hell out of me, when debugging sd_notify() issues) Follow-up for: 623a00020f116d8e9c70608a9e4f7cc978342441
Diffstat (limited to 'src/notify')
-rw-r--r--src/notify/notify.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/notify/notify.c b/src/notify/notify.c
index 8489b83873..21e004e417 100644
--- a/src/notify/notify.c
+++ b/src/notify/notify.c
@@ -467,6 +467,11 @@ static int run(int argc, char* argv[]) {
return log_error_errno(errno, "Failed to execute command line: %s", cmdline);
}
+ /* The DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE() boilerplate will send the exit status via
+ * sd_notify(). Which is normally fine, but very confusing in systemd-notify, whose purpose is to
+ * send user-controllable notification messages, and not implicit ones. Let's turn if off, by
+ * unsetting the $NOTIFY_SOCKET environment variable. */
+ (void) unsetenv("NOTIFY_SOCKET");
return 0;
}