aboutsummaryrefslogtreecommitdiff
path: root/networking/ifupdown.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-12-11 16:48:47 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-12-11 16:48:47 +0100
commit030fe31760169783537162b83af89e551bf120f6 (patch)
tree92b219784b478405626b9259b82900ab3ca72a8e /networking/ifupdown.c
parent56ee5765074b2f2389066f3234a4da21501d3eaa (diff)
downloadbusybox-w32-030fe31760169783537162b83af89e551bf120f6.tar.gz
busybox-w32-030fe31760169783537162b83af89e551bf120f6.tar.bz2
busybox-w32-030fe31760169783537162b83af89e551bf120f6.zip
libbb: make msleep() result in only one syscall instead of looping
function old new delta msleep 45 52 +7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to '')
-rw-r--r--networking/ifupdown.c6
1 files changed, 3 insertions, 3 deletions
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)
1357 IFSTATE_FILE_PATH".new"); 1357 IFSTATE_FILE_PATH".new");
1358 } 1358 }
1359 /* Someone else created the .new file */ 1359 /* Someone else created the .new file */
1360 if (cnt > 30 * 1000) { 1360 if (cnt > 30) {
1361 /* Waited for 30*30/2 = 450 milliseconds, still EEXIST. 1361 /* Waited for 30*30/2 = 450 milliseconds, still EEXIST.
1362 * Assuming a stale file, rewriting it. 1362 * Assuming a stale file, rewriting it.
1363 */ 1363 */
1364 flags = (O_WRONLY | O_CREAT | O_TRUNC); 1364 flags = (O_WRONLY | O_CREAT | O_TRUNC);
1365 continue; 1365 continue;
1366 } 1366 }
1367 usleep(cnt); 1367 msleep(cnt);
1368 cnt += 1000; 1368 cnt++;
1369 } 1369 }
1370 1370
1371 return xfdopen_for_write(fd); 1371 return xfdopen_for_write(fd);