summaryrefslogtreecommitdiff
path: root/src/notify
diff options
context:
space:
mode:
authorBenjamin Robin <dev@benjarobin.fr>2015-09-19 21:57:51 +0200
committerHarald Hoyer <harald@redhat.com>2015-09-20 04:02:20 +0200
commit9de009a9f5dd0eb6eaba878a49d5f3317cc9b8a5 (patch)
tree573eedd8f1b5da3ecbaa3fad3fbf35818b6b819d /src/notify
parentdcc26ae383dd935afcbaa263f8db8ee5e1f03fbd (diff)
downloadsystemd-9de009a9f5dd0eb6eaba878a49d5f3317cc9b8a5.tar.gz
systemd-notify: Always pass a valid pid to sd_pid_notify
If the option --pid was used, take the pid from this option, unless take the parend pid. Using 0 as pid (ucred of systemd-notify) will result 99% of the time in a failure with this error: "Cannot find unit for notify message of PID" Shouldn't we use always the ppid, since the MAINPID is something else ? Signed-off-by: Benjamin Robin <dev@benjarobin.fr>
Diffstat (limited to 'src/notify')
-rw-r--r--src/notify/notify.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/notify/notify.c b/src/notify/notify.c
index c303bcf718..772e3db69d 100644
--- a/src/notify/notify.c
+++ b/src/notify/notify.c
@@ -191,7 +191,7 @@ int main(int argc, char* argv[]) {
goto finish;
}
- r = sd_pid_notify(arg_pid, false, n);
+ r = sd_pid_notify(arg_pid ? arg_pid : getppid(), false, n);
if (r < 0) {
log_error_errno(r, "Failed to notify init system: %m");
goto finish;