summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUmut Tezduyar Lindskog <umut.tezduyar@axis.com>2014-04-27 22:01:42 +0200
committerTom Gundersen <teg@jklm.no>2014-04-27 23:41:46 +0200
commitccfdc9a11256dc9b88860583924b5e57a9bb4ed1 (patch)
tree59f7a53d4bd46d11c599e05c103fddc1e7cf1e34
parentd9bf4f8c6c47b8620ffa1a056208eb15118b78d5 (diff)
sd-dhcp-client: log positive error number
Log error no for such client_stop(client, DHCP_EVENT_STOP)
-rw-r--r--src/libsystemd-network/sd-dhcp-client.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
index 14f226793c..2ddb9ad1dc 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);