[systemd-devel] [systemd-commits] src/libsystemd-network src/systemd

Tom Gundersen teg at jklm.no
Tue Apr 29 03:40:31 PDT 2014


On Tue, Apr 29, 2014 at 12:37 PM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Tue, 29.04.14 03:27, Tom Gundersen (tomegun at 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


More information about the systemd-devel mailing list