summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-03-09 22:19:52 +0100
committerTom Gundersen <teg@jklm.no>2015-03-09 22:38:51 +0100
commitdfc4b6acf088f71f717fce8866a5841091219fa5 (patch)
tree16cfc85670a590d47f0b6031e0eb0e61549a72e8 /src/udev
parent7432b24b8357d913943580b442ffe7040e610f9e (diff)
udev: simplify event_queue_update() and add debug logging
This essentially replaces open("/run/udev/queue", O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444) with open("/run/udev/queue", O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, 0644), which is ok for our purposes.
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udevd.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 1c510f44ff..c01fb4bb94 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -904,14 +904,17 @@ static void handle_signal(struct udev *udev, int signo) {
}
static void event_queue_update(void) {
- if (!udev_list_node_is_empty(&event_list)) {
- int fd;
+ int r;
- fd = open("/run/udev/queue", O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444);
- if (fd >= 0)
- close(fd);
- } else
- unlink("/run/udev/queue");
+ if (!udev_list_node_is_empty(&event_list)) {
+ r = touch("/run/udev/queue");
+ if (r < 0)
+ log_warning_errno(r, "could not touch /run/udev/queue: %m");
+ } else {
+ r = unlink("/run/udev/queue");
+ if (r < 0 && errno != ENOENT)
+ log_warning("could not unlink /run/udev/queue: %m");
+ }
}
static int systemd_fds(struct udev *udev, int *rctrl, int *rnetlink) {