From 09e766e70b7d8a187c210a6e1892f825aa282299 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 3 May 2023 14:14:06 +0200 Subject: 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 --- src/notify/notify.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/notify') 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; } -- cgit v1.2.1