From ccfdc9a11256dc9b88860583924b5e57a9bb4ed1 Mon Sep 17 00:00:00 2001 From: Umut Tezduyar Lindskog Date: Sun, 27 Apr 2014 22:01:42 +0200 Subject: [PATCH] sd-dhcp-client: log positive error number Log error no for such client_stop(client, DHCP_EVENT_STOP) --- src/libsystemd-network/sd-dhcp-client.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c index 14f226793..2ddb9ad1d 100644 --- a/src/libsystemd-network/sd-dhcp-client.c +++ b/src/libsystemd-network/sd-dhcp-client.c @@ -231,7 +231,21 @@ static int client_initialize(sd_dhcp_client *client) { static sd_dhcp_client *client_stop(sd_dhcp_client *client, int error) { assert_return(client, NULL); - log_dhcp_client(client, "STOPPED: %s", strerror(-error)); + if (error < 0) + log_dhcp_client(client, "STOPPED: %s", strerror(-error)); + else { + switch(error) { + case DHCP_EVENT_STOP: + log_dhcp_client(client, "STOPPED: Requested by user"); + break; + case DHCP_EVENT_NO_LEASE: + log_dhcp_client(client, "STOPPED: No lease"); + break; + default: + log_dhcp_client(client, "STOPPED: Unknown reason"); + break; + } + } client = client_notify(client, error); -- 2.30.2