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

Tom Gundersen teg at jklm.no
Sun Apr 13 09:01:57 PDT 2014


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?

-t


More information about the systemd-devel mailing list