From 030fe31760169783537162b83af89e551bf120f6 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 11 Dec 2020 16:48:47 +0100 Subject: libbb: make msleep() result in only one syscall instead of looping function old new delta msleep 45 52 +7 Signed-off-by: Denys Vlasenko --- networking/ifupdown.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'networking') diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 60ceb5a1f..fedf05aaf 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c @@ -1357,15 +1357,15 @@ static FILE *open_new_state_file(void) IFSTATE_FILE_PATH".new"); } /* Someone else created the .new file */ - if (cnt > 30 * 1000) { + if (cnt > 30) { /* Waited for 30*30/2 = 450 milliseconds, still EEXIST. * Assuming a stale file, rewriting it. */ flags = (O_WRONLY | O_CREAT | O_TRUNC); continue; } - usleep(cnt); - cnt += 1000; + msleep(cnt); + cnt++; } return xfdopen_for_write(fd); -- cgit v1.2.3