summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2011-05-16 13:17:48 +0200
committerKay Sievers <kay.sievers@vrfy.org>2011-05-16 13:17:48 +0200
commit2738ec2cf721db0c0deac2ba0abdc73cf7739e9f (patch)
tree8720c177336b21856437511f5af7c5c82d5a9496
parentdf2ee940d8852b63756e015cfb755e6454dd4f1b (diff)
udevd: create queue file before daemonizing to reliably block 'settle'
-rw-r--r--udev/udevd.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/udev/udevd.c b/udev/udevd.c
index be4b071ebb..258d7870eb 100644
--- a/udev/udevd.c
+++ b/udev/udevd.c
@@ -1408,6 +1408,13 @@ int main(int argc, char *argv[])
udev_monitor_set_receive_buffer_size(monitor, 128*1024*1024);
+ /* create queue file before signalling 'ready', to make sure we block 'settle' */
+ udev_queue_export = udev_queue_export_new(udev);
+ if (udev_queue_export == NULL) {
+ err(udev, "error creating queue file\n");
+ goto exit;
+ }
+
if (daemonize) {
pid_t pid;
int fd;
@@ -1421,8 +1428,8 @@ int main(int argc, char *argv[])
rc = 4;
goto exit;
default:
- rc = 0;
- goto exit;
+ rc = EXIT_SUCCESS;
+ goto exit_keep_queue;
}
setsid();
@@ -1521,12 +1528,6 @@ int main(int argc, char *argv[])
goto exit;
}
- udev_queue_export = udev_queue_export_new(udev);
- if (udev_queue_export == NULL) {
- err(udev, "error creating queue file\n");
- goto exit;
- }
-
memset(&ep_ctrl, 0, sizeof(struct epoll_event));
ep_ctrl.events = EPOLLIN;
ep_ctrl.data.fd = fd_ctrl;
@@ -1708,9 +1709,10 @@ int main(int argc, char *argv[])
}
}
- udev_queue_export_cleanup(udev_queue_export);
- rc = 0;
+ rc = EXIT_SUCCESS;
exit:
+ udev_queue_export_cleanup(udev_queue_export);
+exit_keep_queue:
if (fd_ep >= 0)
close(fd_ep);
worker_list_cleanup(udev);