ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
c62b8e
From c34ec3588a40e595bb837f3c12e44808c7cd20fd Mon Sep 17 00:00:00 2001
c62b8e
From: Michal Sekletar <msekleta@redhat.com>
c62b8e
Date: Wed, 1 May 2019 15:52:42 +0200
c62b8e
Subject: [PATCH] udev: call poll() again after killing the spawned process
c62b8e
c62b8e
Later we check .revents of pfd. Hence we need to initialize it properly
c62b8e
and to do that we need to call poll() once again because previously it
c62b8e
exited twice with timeout and hence left pfd uninitialized. For the
c62b8e
third time it should return immediately since we killed the spawned
c62b8e
process with SIGKILL.
c62b8e
c62b8e
Related: #1697909
c62b8e
---
c62b8e
 src/udev/udev-event.c | 4 ++++
c62b8e
 1 file changed, 4 insertions(+)
c62b8e
c62b8e
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
c62b8e
index 7fe64f04a4..07b82d093e 100644
c62b8e
--- a/src/udev/udev-event.c
c62b8e
+++ b/src/udev/udev-event.c
c62b8e
@@ -593,6 +593,10 @@ static int spawn_wait(struct udev_event *event,
c62b8e
                         if (fdcount == 0) {
c62b8e
                                 log_error("timeout: killing '%s' ["PID_FMT"]", cmd, pid);
c62b8e
                                 kill(pid, SIGKILL);
c62b8e
+
c62b8e
+                                fdcount = poll(pfd, 1, 1000);
c62b8e
+                                if (fdcount <= 0)
c62b8e
+                                        continue;
c62b8e
                         }
c62b8e
                 }
c62b8e