]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dhcp: replace strerror() with %m
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 3 Jul 2019 14:55:45 +0000 (23:55 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 4 Jul 2019 17:43:56 +0000 (02:43 +0900)
src/libsystemd-network/sd-dhcp-client.c
src/libsystemd-network/sd-dhcp6-lease.c

index b0f0f849379e622ebb825c636e30e975e5407ece..85238c21d1efc954b2a6cfff975b6953a2313e00 100644 (file)
@@ -576,7 +576,7 @@ static void client_stop(sd_dhcp_client *client, int error) {
         assert(client);
 
         if (error < 0)
-                log_dhcp_client(client, "STOPPED: %s", strerror(-error));
+                log_dhcp_client_errno(client, error, "STOPPED: %m");
         else if (error == SD_DHCP_CLIENT_EVENT_STOP)
                 log_dhcp_client(client, "STOPPED");
         else
index 8b424811ad16a97ba170aea81e7b509f93ed9e77..8aebb53c873da63c6d0e0d889070c4188718cf51 100644 (file)
@@ -205,12 +205,8 @@ int dhcp6_lease_set_dns(sd_dhcp6_lease *lease, uint8_t *optval, size_t optlen) {
         r = dhcp6_option_parse_ip6addrs(optval, optlen, &lease->dns,
                                         lease->dns_count,
                                         &lease->dns_allocated);
-        if (r < 0) {
-                log_dhcp6_client(client, "Invalid DNS server option: %s",
-                                 strerror(-r));
-
-                return r;
-        }
+        if (r < 0)
+                return log_dhcp6_client_errno(client, r, "Invalid DNS server option: %m");
 
         lease->dns_count = r;
 
@@ -336,12 +332,8 @@ int dhcp6_lease_set_sntp(sd_dhcp6_lease *lease, uint8_t *optval, size_t optlen)
         r = dhcp6_option_parse_ip6addrs(optval, optlen, &lease->ntp,
                                         lease->ntp_count,
                                         &lease->ntp_allocated);
-        if (r < 0) {
-                log_dhcp6_client(client, "Invalid SNTP server option: %s",
-                                 strerror(-r));
-
-                return r;
-        }
+        if (r < 0)
+                return log_dhcp6_client_errno(client, r, "Invalid SNTP server option: %m");
 
         lease->ntp_count = r;