803fb7
From 98b78068d13095fdd40883b2b6c815a9ebb59435 Mon Sep 17 00:00:00 2001
803fb7
From: Nir Soffer <nirsof@gmail.com>
803fb7
Date: Sun, 19 Apr 2015 03:41:26 +0300
803fb7
Subject: [PATCH] udev: settle should return immediately when timeout is 0
803fb7
803fb7
udevadm manual says:
803fb7
803fb7
    A value of 0 will check if the queue is empty and always return
803fb7
    immediately.
803fb7
803fb7
However, currently we ignore the deadline if the value is 0, and wait
803fb7
without any limit.
803fb7
803fb7
Zero timeout behaved according to the documentation until commit
803fb7
ead7c62ab7 (udevadm: settle - kill alarm()). Looking at this patch, it
803fb7
seems that the behavior change was unintended.
803fb7
803fb7
This patch restores the documented behavior.
803fb7
803fb7
Cherry-picked from: bf23b9f86f6807c3029a6a46e1999ae0c87ca22a
803fb7
Resolves: #1210981
803fb7
---
803fb7
 src/udev/udevadm-settle.c | 2 +-
803fb7
 1 file changed, 1 insertion(+), 1 deletion(-)
803fb7
803fb7
diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c
803fb7
index e60c4623b..40e3e28b1 100644
803fb7
--- a/src/udev/udevadm-settle.c
803fb7
+++ b/src/udev/udevadm-settle.c
803fb7
@@ -149,7 +149,7 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) {
803fb7
                         break;
803fb7
                 }
803fb7
 
803fb7
-                if (timeout > 0 && now(CLOCK_MONOTONIC) >= deadline)
803fb7
+                if (now(CLOCK_MONOTONIC) >= deadline)
803fb7
                         break;
803fb7
 
803fb7
                 /* wake up when queue is empty */