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