X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fask-password-api.c;h=04d5623d9ee19597bf849de6a13c7c018d5b5dcf;hp=384cfc8f8058cdd12a0bb7bf3f6cdd123ae4a5ef;hb=31a5f880cf7a742e63a81bacef681939ee4e6616;hpb=8254a475893e746eb667c0666a69a871d7fc4732 diff --git a/src/ask-password-api.c b/src/ask-password-api.c index 384cfc8f8..04d5623d9 100644 --- a/src/ask-password-api.c +++ b/src/ask-password-api.c @@ -404,13 +404,13 @@ int ask_password_agent( t = now(CLOCK_MONOTONIC); - if (until <= t) { + if (until > 0 && until <= t) { log_notice("Timed out"); r = -ETIME; goto finish; } - if ((k = poll(pollfd, _FD_MAX, (until-t)/USEC_PER_MSEC)) < 0) { + if ((k = poll(pollfd, _FD_MAX, until > 0 ? (int) ((until-t)/USEC_PER_MSEC) : -1)) < 0) { if (errno == EINTR) continue;