summaryrefslogtreecommitdiff
path: root/src/shared/ask-password-api.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-02-13 23:57:57 +0100
committerLennart Poettering <lennart@poettering.net>2018-02-14 00:03:05 +0100
commitc9eb4a00542e9183a624190cef64d27c560254bd (patch)
treedcc80480493055d86ff8230023d3980b1e5e9330 /src/shared/ask-password-api.c
parent70dee4755a573f538e8897f97dde868bc1741170 (diff)
downloadsystemd-c9eb4a00542e9183a624190cef64d27c560254bd.tar.gz
ask-password: round up when determining sleep time
We should rather sleep to much than too little. This otherwise might result in a busy loop, because we slept too little and then recheck again coming to the conclusion we need to go to sleep again, and so on.
Diffstat (limited to 'src/shared/ask-password-api.c')
-rw-r--r--src/shared/ask-password-api.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c
index fbe8d06c34..d727f5b142 100644
--- a/src/shared/ask-password-api.c
+++ b/src/shared/ask-password-api.c
@@ -291,7 +291,7 @@ int ask_password_tty(
goto finish;
}
- sleep_for = (int) ((until - y) / USEC_PER_MSEC);
+ sleep_for = (int) DIV_ROUND_UP(until - y, USEC_PER_MSEC);
}
if (flag_file)