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

David Herrmann dh.herrmann at gmail.com
Mon Apr 20 09:58:17 PDT 2015


Hi

On Sun, Apr 19, 2015 at 1:49 AM, Nir Soffer <nirsof at gmail.com> wrote:
> 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;

This looks much more reasonable to me. I'd prefer some sanity-timeout,
though. 1s or 5s or something like this. Kay?

Thanks
David


More information about the systemd-devel mailing list