mirror of
https://github.com/sheumann/hush.git
synced 2024-08-21 11:28:57 +00:00
dhcpd: write lease file on exit
function old new delta udhcpd_main 1431 1403 -28 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
d3a42391b1
commit
71045cc819
@ -377,6 +377,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
/* Setup the signal pipe */
|
/* Setup the signal pipe */
|
||||||
udhcp_sp_setup();
|
udhcp_sp_setup();
|
||||||
|
|
||||||
|
continue_with_autotime:
|
||||||
timeout_end = monotonic_sec() + server_config.auto_time;
|
timeout_end = monotonic_sec() + server_config.auto_time;
|
||||||
while (1) { /* loop until universe collapses */
|
while (1) { /* loop until universe collapses */
|
||||||
fd_set rfds;
|
fd_set rfds;
|
||||||
@ -406,8 +407,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
}
|
}
|
||||||
if (retval == 0) {
|
if (retval == 0) {
|
||||||
write_leases();
|
write_leases();
|
||||||
timeout_end = monotonic_sec() + server_config.auto_time;
|
goto continue_with_autotime;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if (retval < 0 && errno != EINTR) {
|
if (retval < 0 && errno != EINTR) {
|
||||||
log1("Error on select");
|
log1("Error on select");
|
||||||
@ -419,10 +419,10 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
bb_info_msg("Received SIGUSR1");
|
bb_info_msg("Received SIGUSR1");
|
||||||
write_leases();
|
write_leases();
|
||||||
/* why not just reset the timeout, eh */
|
/* why not just reset the timeout, eh */
|
||||||
timeout_end = monotonic_sec() + server_config.auto_time;
|
goto continue_with_autotime;
|
||||||
continue;
|
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
bb_info_msg("Received SIGTERM");
|
bb_info_msg("Received SIGTERM");
|
||||||
|
write_leases();
|
||||||
goto ret0;
|
goto ret0;
|
||||||
case 0: /* no signal: read a packet */
|
case 0: /* no signal: read a packet */
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user