1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

sd-dhcp-client: log positive error number

Log error no for such client_stop(client, DHCP_EVENT_STOP)
This commit is contained in:
Umut Tezduyar Lindskog 2014-04-27 22:01:42 +02:00 committed by Tom Gundersen
parent d9bf4f8c6c
commit ccfdc9a112

View 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);
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);