diff options
author | Tom Gundersen <teg@jklm.no> | 2015-04-24 20:36:02 +0200 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2015-05-03 16:07:21 -0400 |
commit | 349ade7cf28c681d09de982519395c9f8fbe7554 (patch) | |
tree | 9257f44d2a78539426bec1ae689d9c521d39d8b1 /src/udev/udevd.c | |
parent | adfa2ca4d5a02b2e8b7b1a4ec2e71c2295d17b1e (diff) |
udevd: worker - log if worker result cannot be sent
If the main daemon is not notified about a worker finishing an event
the refcounting of the worker struct will be wrong, and we will lose
track of the number of children we have to wait for.
This should not happen, but if it does we better complain loudly about
it. Worst case udev will wait for 30 seconsd at shutdown waiting for
nonexistent workers.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/udev/udevd.c')
-rw-r--r-- | src/udev/udevd.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c index b916b755dd..d56e3d1ed9 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -257,7 +257,7 @@ static void worker_new(struct event *event) { struct udev_event *udev_event; struct worker_message msg; int fd_lock = -1; - int err = 0; + int err = 0, r; log_debug("seq %llu running", udev_device_get_seqnum(dev)); udev_event = udev_event_new(dev); @@ -323,12 +323,15 @@ static void worker_new(struct event *event) { udev_monitor_send_device(worker_monitor, NULL, dev); skip: + log_debug("seq %llu processed with %i", udev_device_get_seqnum(dev), err); + /* send udevd the result of the event execution */ memzero(&msg, sizeof(struct worker_message)); msg.exitcode = err; - send(worker_watch[WRITE_END], &msg, sizeof(struct worker_message), 0); - - log_debug("seq %llu processed with %i", udev_device_get_seqnum(dev), err); + r = send(worker_watch[WRITE_END], &msg, sizeof(struct worker_message), 0); + if (r < 0) + log_error_errno(errno, "failed to send result of seq %llu to main daemon: %m", + udev_device_get_seqnum(dev)); udev_device_unref(dev); dev = NULL; |