teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
Blob Blame History Raw
From 188465c472996b426a1f22a9fc46d031b722c3b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 10 Nov 2020 12:57:34 +0100
Subject: [PATCH] sd-event: increase n_enabled_child_sources just once

Neither source_child_pidfd_register() nor event_make_signal_data() look at
n_enabled_child_sources.

(cherry picked from commit ac9f2640cb9c107b43f47bba7e068d3b92b5337b)

Related: #1819868
---
 src/libsystemd/sd-event/sd-event.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index 0cfba8fb39..d18ce28a92 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -2383,8 +2383,6 @@ static int event_source_enable(sd_event_source *s, int enable) {
                 break;
 
         case SOURCE_CHILD:
-                s->event->n_enabled_child_sources++;
-
                 r = event_make_signal_data(s->event, SIGCHLD, NULL);
                 if (r < 0) {
                         s->enabled = SD_EVENT_OFF;
@@ -2393,6 +2391,7 @@ static int event_source_enable(sd_event_source *s, int enable) {
                         return r;
                 }
 
+                s->event->n_enabled_child_sources++;
 
                 break;