On Tue, Apr 29, 2014 at 12:37 PM, Lennart Poettering
<lenn...@poettering.net> wrote:
> On Tue, 29.04.14 03:27, Tom Gundersen (tome...@kemper.freedesktop.org) wrote:
>
>> +        case DHCP_OPTION_NTP_SERVER:
>> +                if (len && !(len % 4)) {
>> +                        unsigned i;
>> +
>> +                        lease->ntp_size = len / 4;
>> +
>> +                        free(lease->ntp);
>> +                        lease->ntp = new0(struct in_addr, lease->ntp_size);
>> +                        if (!lease->ntp)
>> +                                return -ENOMEM;
>> +
>> +                        for (i = 0; i < lease->ntp_size; i++) {
>> +                                memcpy(&lease->ntp[i].s_addr, option + 4 * 
>> i, 4);
>> +                        }
>
> This should be shorter, no?
>
>     lease->ntp = newdup(struct in_addr, option, lease->ntp_size);
>     if (!lease->ntp) ...

Oh, cool, didn't know about that one.

Will fix.

Cheers,

Tom
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to