From: Lennart Poettering Date: Tue, 13 Feb 2018 22:57:57 +0000 (+0100) Subject: ask-password: round up when determining sleep time X-Git-Tag: v238~100^2~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c9eb4a00542e9183a624190cef64d27c560254bd;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c index fbe8d06c34d..d727f5b142d 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)