chiark / gitweb /
udevadm-settle: fixed return code for empty queue
authorHarald Hoyer <harald@redhat.com>
Tue, 20 May 2014 10:25:16 +0000 (12:25 +0200)
committerHarald Hoyer <harald@redhat.com>
Tue, 20 May 2014 10:25:16 +0000 (12:25 +0200)
If the udev queue is empty and "/run/udev/queue" does not exist,
"udevadm settle" would return with EXIT_FAILURE, because the inotify on
"/run/udev/queue" would fail with ENOENT.

This patch lets "udevadm settle" exit with EXIT_SUCCESS in this case.

src/udev/udevadm-settle.c

index 65fc35f9a076f87c45c1712e2464a56ba98b0e52..66fd843012393fac123bd86514ddad5e46a4c374 100644 (file)
@@ -116,7 +116,11 @@ static int adm_settle(struct udev *udev, int argc, char *argv[])
         }
 
         if (inotify_add_watch(pfd[0].fd, "/run/udev/queue" , IN_DELETE) < 0) {
         }
 
         if (inotify_add_watch(pfd[0].fd, "/run/udev/queue" , IN_DELETE) < 0) {
-                log_debug("watching /run/udev failed");
+                /* If it does not exist, we don't have to wait */
+                if (errno == ENOENT)
+                        rc = EXIT_SUCCESS;
+                else
+                        log_debug("watching /run/udev/queue failed");
                 goto out;
         }
 
                 goto out;
         }