[systemd-devel] [PATCH] core/service: check if mainpid matches only if it set
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Mon Dec 30 08:26:19 PST 2013
https://bugzilla.redhat.com/show_bug.cgi?id=1047304
---
src/core/service.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/core/service.c b/src/core/service.c
index 2557579..f8502a8 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -3347,6 +3347,9 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
assert(u);
+ log_debug_unit(u->id, "%s: Got notification message from PID %lu (%s...)",
+ u->id, (unsigned long) pid, tags && *tags ? tags[0] : "(empty)");
+
if (s->notify_access == NOTIFY_NONE) {
log_warning_unit(u->id,
"%s: Got notification message from PID %lu, but reception is disabled.",
@@ -3354,15 +3357,13 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
return;
}
- if (s->notify_access == NOTIFY_MAIN && pid != s->main_pid) {
+ 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 %lu, but reception only permitted for PID %lu",
u->id, (unsigned long) pid, (unsigned long) s->main_pid);
return;
}
- log_debug_unit(u->id, "%s: Got message", u->id);
-
/* Interpret MAINPID= */
if ((e = strv_find_prefix(tags, "MAINPID=")) &&
(s->state == SERVICE_START ||
--
1.8.4.2
More information about the systemd-devel
mailing list