[systemd-devel] [PATCH] sd-dhcp-client: log positive error number

Umut Tezduyar Lindskog umut at tezduyar.com
Sun Apr 13 09:20:54 PDT 2014


On Sun, Apr 13, 2014 at 6:01 PM, Tom Gundersen <teg at jklm.no> wrote:
> On Sun, Apr 13, 2014 at 2:11 PM, Umut Tezduyar Lindskog
> <umut at tezduyar.com> wrote:
>> On Sun, Apr 13, 2014 at 1:16 PM, Tom Gundersen <teg at jklm.no> wrote:
>>> Hm, why? Are not error messages more useful?
>>
>> What is going to be the mapping for DHCP_EVENT_STOP?
>>
>> log_dhcp_client(client, "STOPPED: %s", strerror(-DHCP_EVENT_STOP));
>>
>
> Ah, now I get it. I guess we should special case this to something like:
>
> if (r >= 0)
>         log_dhcp_client(client, "STOPPED");
> else
>         log_dhcp_client(client, "STOPPED: %s", strerror(-r));
>
> That way we get the error messages, but avoid things like "STOPPED:
> Success." as well as the problem you pointed out.
>
> What do you think?

I can see following 2 cases of client stopping it self.

client_stop(client, DHCP_EVENT_NO_LEASE);
client_stop(client, DHCP_EVENT_STOP);

>
> -t

Umut


More information about the systemd-devel mailing list