chiark / gitweb /
udevd, udev-event: sync waitpid() error handling
authorKay Sievers <kay.sievers@vrfy.org>
Thu, 21 Apr 2011 12:05:34 +0000 (14:05 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Thu, 21 Apr 2011 12:05:34 +0000 (14:05 +0200)
NEWS
udev/udev-event.c
udev/udevd.c

diff --git a/NEWS b/NEWS
index 27be44c5a8307a87d3cfc2dabf576cbd693e235a..89b5b9c39aa26b858664891aba0bac5f7cd5d801 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,11 +2,12 @@ udev 168
 ========
 Bugfixes.
 
-warning if /run is not writable.
+warning if /run is not writable
 
 udevadm control --exit
 
 udevadm info --cleanup-db
+if used, OPTIONS+="db_persist" needed for LVM
 
 systemd netlink socket activation
 stop socket or mask on rpm update
index ef21ce8f6b1a5d774309226586fdbd49cf47c56b..4af3e08f60e4c20727c7430b7e7cc18916a665ce 100644 (file)
@@ -660,7 +660,7 @@ static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid)
                        goto out;
                }
                if (fdcount == 0) {
-                       err(udev, "timeout: killing '%s'[%u]\n", cmd, pid);
+                       err(udev, "timeout: killing '%s' [%u]\n", cmd, pid);
                        kill(pid, SIGKILL);
                }
 
@@ -681,14 +681,20 @@ static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid)
                                if (waitpid(pid, &status, WNOHANG) < 0)
                                        break;
                                if (WIFEXITED(status)) {
-                                       info(udev, "'%s'[%u] returned with exitcode %i\n", cmd, pid, WEXITSTATUS(status));
+                                       info(udev, "'%s' [%u] exit with return code %i\n", cmd, pid, WEXITSTATUS(status));
                                        if (WEXITSTATUS(status) != 0)
                                                err = -1;
                                } else if (WIFSIGNALED(status)) {
-                                       err(udev, "'%s'[%u] terminated by signal %i\n", cmd, pid, WTERMSIG(status));
+                                       err(udev, "'%s' [%u] terminated by signal %i (%s)\n", cmd, pid, WTERMSIG(status), strsignal(WTERMSIG(status)));
+                                       err = -1;
+                               } else if (WIFSTOPPED(status)) {
+                                       err(udev, "'%s' [%u] stopped\n", cmd, pid);
+                                       err = -1;
+                               } else if (WIFCONTINUED(status)) {
+                                       err(udev, "'%s' [%u] continued\n", cmd, pid);
                                        err = -1;
                                } else {
-                                       err(udev, "'%s'[%u] unexpected exit with status 0x%04x\n", cmd, pid, status);
+                                       err(udev, "'%s' [%u] exit with status 0x%04x\n", cmd, pid, status);
                                        err = -1;
                                }
                                pid = 0;
index 0e73f81069630541bb4e7a53d3657446782466be..be4b071ebb0fcd8bce27652f61917d08c3abdb26 100644 (file)
@@ -809,24 +809,29 @@ static void handle_signal(struct udev *udev, int signo)
 
                                if (worker->pid != pid)
                                        continue;
-
                                info(udev, "worker [%u] exit\n", pid);
-                               if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
-                                       if (WEXITSTATUS(status))
-                                               err(udev, "worker [%u] unexpectedly returned with status %d\n", pid, WEXITSTATUS(status));
-                                       else if (WIFSIGNALED(status))
-                                         err(udev, "worker [%u] killed by signal %d (%s)\n", pid, 
-                                             WTERMSIG(status), strsignal(WTERMSIG(status)));
-                                       else if (WIFSTOPPED(status))
-                                               err(udev, "worker [%u] unexpectedly stopped\n", pid);
-                                       else if (WIFCONTINUED(status))
-                                               err(udev, "worker [%u] continued\n", pid);
 
+                               if (WIFEXITED(status)) {
+                                       if (WEXITSTATUS(status) != 0)
+                                               err(udev, "worker [%u] exit with return code %i\n", pid, WEXITSTATUS(status));
+                               } else if (WIFSIGNALED(status)) {
+                                       err(udev, "worker [%u] terminated by signal %i (%s)\n",
+                                           pid, WTERMSIG(status), strsignal(WTERMSIG(status)));
+                               } else if (WIFSTOPPED(status)) {
+                                       err(udev, "worker [%u] stopped\n", pid);
+                               } else if (WIFCONTINUED(status)) {
+                                       err(udev, "worker [%u] continued\n", pid);
+                               } else {
+                                       err(udev, "worker [%u] exit with status 0x%04x\n", pid, status);
+                               }
+
+                               if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
                                        if (worker->event != NULL) {
-                                               err(udev, "worker [%u] failed while handling '%s'\n", pid, worker->event->devpath);
+                                               err(udev, "worker [%u] failed while handling '%s'\n",
+                                                   pid, worker->event->devpath);
                                                worker->event->exitcode = -32;
                                                event_queue_delete(worker->event, true);
-                                               /* drop reference from running event */
+                                               /* drop reference taken for state 'running' */
                                                worker_unref(worker);
                                        }
                                }