return -ESRCH;
}
+ r = get_process_state(pid);
+ if (r < 0) {
+ if (may_warn)
+ log_info_unit(UNIT(s)->id, "Failed to read /proc/%d/stat: %s",
+ pid, strerror(-r));
+ return r;
+ } else if (r == 'Z') {
+ if (may_warn)
+ log_info_unit(UNIT(s)->id,
+ "PID "PID_FMT" read from file %s is a zombie.",
+ pid, s->pid_file);
+ return -ESRCH;
+ }
+
if (s->main_pid_known) {
if (pid == s->main_pid)
return 0;
return;
}
- if (s->notify_access == NOTIFY_MAIN && s->main_pid != 0 && pid != s->main_pid) {
- log_warning_unit(u->id,
- "%s: Got notification message from PID "PID_FMT", but reception only permitted for PID "PID_FMT,
- u->id, pid, s->main_pid);
+ if (s->notify_access == NOTIFY_MAIN && pid != s->main_pid) {
+
+ if (s->main_pid != 0)
+ log_warning_unit(u->id, "%s: Got notification message from PID "PID_FMT", but reception only permitted for main PID "PID_FMT, u->id, pid, s->main_pid);
+ else
+ log_debug_unit(u->id, "%s: Got notification message from PID "PID_FMT", but reception only permitted for main PID which is currently not known", u->id, pid);
return;
}