aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2012-07-24 17:21:26 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2012-07-24 17:21:26 +0200
commit71045cc819cc2a3c7e20bf7aba5cfeb8acfd9dad (patch)
tree0b2cfe278830d18874d781ce25cc4c220fd75cf0
parentd3a42391b12b5428a246166e76175edbafbba069 (diff)
downloadbusybox-w32-71045cc819cc2a3c7e20bf7aba5cfeb8acfd9dad.tar.gz
busybox-w32-71045cc819cc2a3c7e20bf7aba5cfeb8acfd9dad.tar.bz2
busybox-w32-71045cc819cc2a3c7e20bf7aba5cfeb8acfd9dad.zip
dhcpd: write lease file on exit
function old new delta udhcpd_main 1431 1403 -28 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/udhcp/dhcpd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
index dd55e70f4..9ad95954d 100644
--- a/networking/udhcp/dhcpd.c
+++ b/networking/udhcp/dhcpd.c
@@ -377,6 +377,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
377 /* Setup the signal pipe */ 377 /* Setup the signal pipe */
378 udhcp_sp_setup(); 378 udhcp_sp_setup();
379 379
380 continue_with_autotime:
380 timeout_end = monotonic_sec() + server_config.auto_time; 381 timeout_end = monotonic_sec() + server_config.auto_time;
381 while (1) { /* loop until universe collapses */ 382 while (1) { /* loop until universe collapses */
382 fd_set rfds; 383 fd_set rfds;
@@ -406,8 +407,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
406 } 407 }
407 if (retval == 0) { 408 if (retval == 0) {
408 write_leases(); 409 write_leases();
409 timeout_end = monotonic_sec() + server_config.auto_time; 410 goto continue_with_autotime;
410 continue;
411 } 411 }
412 if (retval < 0 && errno != EINTR) { 412 if (retval < 0 && errno != EINTR) {
413 log1("Error on select"); 413 log1("Error on select");
@@ -419,10 +419,10 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
419 bb_info_msg("Received SIGUSR1"); 419 bb_info_msg("Received SIGUSR1");
420 write_leases(); 420 write_leases();
421 /* why not just reset the timeout, eh */ 421 /* why not just reset the timeout, eh */
422 timeout_end = monotonic_sec() + server_config.auto_time; 422 goto continue_with_autotime;
423 continue;
424 case SIGTERM: 423 case SIGTERM:
425 bb_info_msg("Received SIGTERM"); 424 bb_info_msg("Received SIGTERM");
425 write_leases();
426 goto ret0; 426 goto ret0;
427 case 0: /* no signal: read a packet */ 427 case 0: /* no signal: read a packet */
428 break; 428 break;