libbb: bb_do_delay(3) -> pause_after_failed_login(), and stop looping there
function old new delta pause_after_failed_login - 9 +9 vlock_main 358 353 -5 sulogin_main 252 247 -5 su_main 484 479 -5 passwd_main 936 931 -5 login_main 967 962 -5 bb_do_delay 68 - -68 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 0/5 up/down: 9/-93) Total: -84 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
@@ -8,13 +8,23 @@
|
||||
*/
|
||||
#include "libbb.h"
|
||||
|
||||
void FAST_FUNC bb_do_delay(int seconds)
|
||||
{
|
||||
time_t start, now;
|
||||
/* void FAST_FUNC bb_do_delay(int seconds) { ... } - no users yet */
|
||||
|
||||
start = time(NULL);
|
||||
#ifndef LOGIN_FAIL_DELAY
|
||||
#define LOGIN_FAIL_DELAY 3
|
||||
#endif
|
||||
void FAST_FUNC pause_after_failed_login(void)
|
||||
{
|
||||
#if 0 /* over-engineered madness */
|
||||
time_t end, diff;
|
||||
|
||||
end = time(NULL) + LOGIN_FAIL_DELAY;
|
||||
diff = LOGIN_FAIL_DELAY;
|
||||
do {
|
||||
sleep(seconds);
|
||||
now = time(NULL);
|
||||
} while ((now - start) < seconds);
|
||||
sleep(diff);
|
||||
diff = end - time(NULL);
|
||||
} while (diff > 0);
|
||||
#else
|
||||
sleep(LOGIN_FAIL_DELAY);
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user