diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-05-03 14:14:06 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-05-03 18:03:05 +0200 |
commit | 09e766e70b7d8a187c210a6e1892f825aa282299 (patch) | |
tree | f541102523a3f4dfecf7d5c84bd3b73f8fd9f22c /src/notify/notify.c | |
parent | test: further extend our collection of corrupted journals (diff) | |
download | systemd-09e766e70b7d8a187c210a6e1892f825aa282299.tar.xz systemd-09e766e70b7d8a187c210a6e1892f825aa282299.zip |
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/notify.c')
-rw-r--r-- | src/notify/notify.c | 5 |
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; } |