diff options
author | Tom Gundersen <teg@jklm.no> | 2015-03-18 19:32:58 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2015-03-18 19:32:58 -0400 |
commit | 95186c2ee4b0507afc393afa0ba99050bef05324 (patch) | |
tree | 948c9c86dfe4b37426310746abb04338235a545a | |
parent | 87bf8c79dccc73e7282982f3e248e9eac9b52a6c (diff) |
udev: simplify event_queue_update() and add debug logging
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
-rw-r--r-- | src/udev/udevd.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c index daa95ba127..6c220341c9 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -900,14 +900,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"); + } } /* |