|
Zbigniew Jędrzejewski-Szmek |
436654 |
From 8bfef09df8e1011c6f413822f4455d084b30ba15 Mon Sep 17 00:00:00 2001
|
|
|
78ba63 |
From: Tom Gundersen <teg@jklm.no>
|
|
|
78ba63 |
Date: Sun, 24 May 2015 15:20:36 +0200
|
|
|
78ba63 |
Subject: [PATCH] udevd: event - fix event queue in daemenozied mode
|
|
|
78ba63 |
MIME-Version: 1.0
|
|
|
78ba63 |
Content-Type: text/plain; charset=UTF-8
|
|
|
78ba63 |
Content-Transfer-Encoding: 8bit
|
|
|
78ba63 |
|
|
|
78ba63 |
We would enforce that events could only be added to the queue from the
|
|
|
78ba63 |
main process, but that brake in daemonized mode. Relax the restriction
|
|
|
78ba63 |
to only allow one process to add events to the queue.
|
|
|
78ba63 |
|
|
|
78ba63 |
Reported by Mantas Mikulėnas.
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
(cherry picked from commit 040e689654ef08c63ab93bf0875865398e8d9c91)
|
|
|
78ba63 |
---
|
|
|
78ba63 |
src/udev/udevd.c | 7 ++++---
|
|
|
78ba63 |
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
78ba63 |
|
|
|
78ba63 |
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
|
|
Zbigniew Jędrzejewski-Szmek |
436654 |
index afd4640ad1..2a9a429e66 100644
|
|
|
78ba63 |
--- a/src/udev/udevd.c
|
|
|
78ba63 |
+++ b/src/udev/udevd.c
|
|
|
78ba63 |
@@ -564,7 +564,10 @@ static int event_queue_insert(Manager *manager, struct udev_device *dev) {
|
|
|
78ba63 |
assert(manager);
|
|
|
78ba63 |
assert(dev);
|
|
|
78ba63 |
|
|
|
78ba63 |
- /* only the main process can add events to the queue */
|
|
|
78ba63 |
+ /* only one process can add events to the queue */
|
|
|
78ba63 |
+ if (manager->pid == 0)
|
|
|
78ba63 |
+ manager->pid = getpid();
|
|
|
78ba63 |
+
|
|
|
78ba63 |
assert(manager->pid == getpid());
|
|
|
78ba63 |
|
|
|
78ba63 |
event = new0(struct event, 1);
|
|
|
78ba63 |
@@ -1300,8 +1303,6 @@ static int manager_new(Manager **ret) {
|
|
|
78ba63 |
if (!manager)
|
|
|
78ba63 |
return log_oom();
|
|
|
78ba63 |
|
|
|
78ba63 |
- manager->pid = getpid();
|
|
|
78ba63 |
-
|
|
|
78ba63 |
manager->fd_ep = -1;
|
|
|
78ba63 |
manager->fd_ctrl = -1;
|
|
|
78ba63 |
manager->fd_uevent = -1;
|