summaryrefslogtreecommitdiff
path: root/src/ask-password-api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ask-password-api.c')
-rw-r--r--src/ask-password-api.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ask-password-api.c b/src/ask-password-api.c
index 384cfc8f80..04d5623d9e 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;