udhcpd: write leases on exit?

Denys Vlasenko vda.linux at googlemail.com
Tue Jul 24 15:22:23 UTC 2012


On Thu, Jul 19, 2012 at 7:05 AM, Michael Tokarev <mjt at tls.msk.ru> wrote:
> Why udhcpd does not write leases file upon
> receipt of termination signal?  Here's the
> code in question (networking/udhcp/udhcpd.c):
>
>                 switch (udhcp_sp_read(&rfds)) {
>                 case SIGUSR1:
>                         bb_info_msg("Received SIGUSR1");
>                         write_leases();
>                         /* why not just reset the timeout, eh */
>                         timeout_end = monotonic_sec() + server_config.auto_time;
>                         continue;
>                 case SIGTERM:
>                         bb_info_msg("Received SIGTERM");
>                         goto ret0;
>                 case 0: /* no signal: read a packet */
>                         break;
>                 default: /* signal or error (probably EINTR): back to select */
>                         continue;
>                 }
>
> I think there should be a call to write_leases()
> right after "Received SIGTERM" message, just like
> it is done in SIGUSR1 case?

Indeed. I added it.

-- 
vda


More information about the busybox mailing list