b677e7
From 188465c472996b426a1f22a9fc46d031b722c3b4 Mon Sep 17 00:00:00 2001
b677e7
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
b677e7
Date: Tue, 10 Nov 2020 12:57:34 +0100
b677e7
Subject: [PATCH] sd-event: increase n_enabled_child_sources just once
b677e7
b677e7
Neither source_child_pidfd_register() nor event_make_signal_data() look at
b677e7
n_enabled_child_sources.
b677e7
b677e7
(cherry picked from commit ac9f2640cb9c107b43f47bba7e068d3b92b5337b)
b677e7
b677e7
Related: #1819868
b677e7
---
b677e7
 src/libsystemd/sd-event/sd-event.c | 3 +--
b677e7
 1 file changed, 1 insertion(+), 2 deletions(-)
b677e7
b677e7
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
b677e7
index 0cfba8fb39..d18ce28a92 100644
b677e7
--- a/src/libsystemd/sd-event/sd-event.c
b677e7
+++ b/src/libsystemd/sd-event/sd-event.c
b677e7
@@ -2383,8 +2383,6 @@ static int event_source_enable(sd_event_source *s, int enable) {
b677e7
                 break;
b677e7
 
b677e7
         case SOURCE_CHILD:
b677e7
-                s->event->n_enabled_child_sources++;
b677e7
-
b677e7
                 r = event_make_signal_data(s->event, SIGCHLD, NULL);
b677e7
                 if (r < 0) {
b677e7
                         s->enabled = SD_EVENT_OFF;
b677e7
@@ -2393,6 +2391,7 @@ static int event_source_enable(sd_event_source *s, int enable) {
b677e7
                         return r;
b677e7
                 }
b677e7
 
b677e7
+                s->event->n_enabled_child_sources++;
b677e7
 
b677e7
                 break;
b677e7