richardphibel / rpms / systemd

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