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