[systemd-devel] [PATCH] udev: Fix ping timeout when settle timeout is 0

Nir Soffer nirsof at gmail.com
Sat Apr 18 16:49:47 PDT 2015


When running udevadm settle --timeout=0, the ping always times out, and
udevadm will return 0 without checking the queue state.

Since zero timeout is considered as unlimited timeout, we use now
unlimited ping timeout.
---
 src/udev/udevadm-settle.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c
index 2c84ada..42eeee4 100644
--- a/src/udev/udevadm-settle.c
+++ b/src/udev/udevadm-settle.c
@@ -107,7 +107,9 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) {
 
                 uctrl = udev_ctrl_new(udev);
                 if (uctrl != NULL) {
-                        if (udev_ctrl_send_ping(uctrl, timeout) < 0) {
+                        int ping_timeout = timeout > 0 ? (int)timeout : -1;
+
+                        if (udev_ctrl_send_ping(uctrl, ping_timeout) < 0) {
                                 log_debug("no connection to daemon");
                                 udev_ctrl_unref(uctrl);
                                 return EXIT_SUCCESS;
-- 
1.9.3



More information about the systemd-devel mailing list