chiark / gitweb /
sd-dhcp-client: log positive error number
authorUmut Tezduyar Lindskog <umut.tezduyar@axis.com>
Sun, 27 Apr 2014 20:01:42 +0000 (22:01 +0200)
committerTom Gundersen <teg@jklm.no>
Sun, 27 Apr 2014 21:41:46 +0000 (23:41 +0200)
Log error no for such client_stop(client, DHCP_EVENT_STOP)

src/libsystemd-network/sd-dhcp-client.c

index 14f226793c996d098ad52ce63417690f49f6467a..2ddb9ad1dca6bcdec44981b4171b0d33f7d03c35 100644 (file)
@@ -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);
 
 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);
 
 
         client = client_notify(client, error);