ryantimwilson / rpms / systemd

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