summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-30 22:16:17 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-30 22:26:16 +0200
commite53fc357a9bb9d0a5362ccc4246d598cb0febd5e (patch)
tree3bb6c3be9ba053e4a280b6c2ae8cd03be8f1ac6d /src/network
parent618234a5258768359cb1086b152c5f08aaf89754 (diff)
tree-wide: remove a number of invocations of strerror() and replace by %m
Let's clean up our tree a bit, and reduce invocations of the thread-unsafe strerror() by replacing it with printf()'s %m specifier.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-dhcp6.c30
-rw-r--r--src/network/networkd-ipv4ll.c9
2 files changed, 14 insertions, 25 deletions
diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c
index 13105c7865..3cb7b8d9ca 100644
--- a/src/network/networkd-dhcp6.c
+++ b/src/network/networkd-dhcp6.c
@@ -53,8 +53,7 @@ static int dhcp6_address_handler(sd_netlink *rtnl, sd_netlink_message *m,
return 1;
}
- log_link_error(link, "Could not set DHCPv6 address: %s",
- strerror(-r));
+ log_link_error_errno(link, r, "Could not set DHCPv6 address: %m");
link_enter_failed(link);
@@ -115,8 +114,7 @@ static int dhcp6_lease_address_acquired(sd_dhcp6_client *client, Link *link) {
r = sd_icmp6_ra_get_prefixlen(link->icmp6_router_discovery,
&ip6_addr, &prefixlen);
if (r < 0 && r != -EADDRNOTAVAIL) {
- log_link_warning(link, "Could not get prefix information: %s",
- strerror(-r));
+ log_link_warning_errno(link, r, "Could not get prefix information: %m");
return r;
}
@@ -172,11 +170,9 @@ static void dhcp6_handler(sd_dhcp6_client *client, int event, void *userdata) {
default:
if (event < 0)
- log_link_warning(link, "DHCPv6 error: %s",
- strerror(-event));
+ log_link_warning_errno(link, event, "DHCPv6 error: %m");
else
- log_link_warning(link, "DHCPv6 unknown event: %d",
- event);
+ log_link_warning(link, "DHCPv6 unknown event: %d", event);
return;
}
@@ -198,24 +194,21 @@ static int dhcp6_configure(Link *link, int event) {
r = sd_dhcp6_client_get_information_request(link->dhcp6_client,
&information_request);
if (r < 0) {
- log_link_warning(link, "Could not get DHCPv6 Information request setting: %s",
- strerror(-r));
+ log_link_warning_errno(link, r, "Could not get DHCPv6 Information request setting: %m");
goto error;
}
if (information_request && event != SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_OTHER) {
r = sd_dhcp6_client_stop(link->dhcp6_client);
if (r < 0) {
- log_link_warning(link, "Could not stop DHCPv6 while setting Managed mode %s",
- strerror(-r));
+ log_link_warning_errno(link, r, "Could not stop DHCPv6 while setting Managed mode: %m");
goto error;
}
r = sd_dhcp6_client_set_information_request(link->dhcp6_client,
false);
if (r < 0) {
- log_link_warning(link, "Could not unset DHCPv6 Information request: %s",
- strerror(-r));
+ log_link_warning_errno(link, r, "Could not unset DHCPv6 Information request: %m");
goto error;
}
@@ -223,8 +216,7 @@ static int dhcp6_configure(Link *link, int event) {
r = sd_dhcp6_client_start(link->dhcp6_client);
if (r < 0 && r != -EALREADY) {
- log_link_warning(link, "Could not restart DHCPv6: %s",
- strerror(-r));
+ log_link_warning_errno(link, r, "Could not restart DHCPv6: %m");
goto error;
}
@@ -343,11 +335,9 @@ static void icmp6_router_handler(sd_icmp6_nd *nd, int event, void *userdata) {
default:
if (event < 0)
- log_link_warning(link, "ICMPv6 error: %s",
- strerror(-event));
+ log_link_warning_errno(link, event, "ICMPv6 error: %m");
else
- log_link_warning(link, "ICMPv6 unknown event: %d",
- event);
+ log_link_warning(link, "ICMPv6 unknown event: %d", event);
break;
}
diff --git a/src/network/networkd-ipv4ll.c b/src/network/networkd-ipv4ll.c
index af3e3884e6..1902b3d23a 100644
--- a/src/network/networkd-ipv4ll.c
+++ b/src/network/networkd-ipv4ll.c
@@ -44,7 +44,7 @@ static int ipv4ll_address_lost(Link *link) {
r = address_new_dynamic(&address);
if (r < 0) {
- log_link_error(link, "Could not allocate address: %s", strerror(-r));
+ log_link_error_errno(link, r, "Could not allocate address: %m");
return r;
}
@@ -57,8 +57,7 @@ static int ipv4ll_address_lost(Link *link) {
r = route_new_dynamic(&route, RTPROT_UNSPEC);
if (r < 0) {
- log_link_error(link, "Could not allocate route: %s",
- strerror(-r));
+ log_link_error_errno(link, r, "Could not allocate route: %m");
return r;
}
@@ -82,7 +81,7 @@ static int ipv4ll_route_handler(sd_netlink *rtnl, sd_netlink_message *m, void *u
r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
- log_link_error(link, "could not set ipv4ll route: %s", strerror(-r));
+ log_link_error_errno(link, r, "could not set ipv4ll route: %m");
link_enter_failed(link);
}
@@ -103,7 +102,7 @@ static int ipv4ll_address_handler(sd_netlink *rtnl, sd_netlink_message *m, void
r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
- log_link_error(link, "could not set ipv4ll address: %s", strerror(-r));
+ log_link_error_errno(link, r, "could not set ipv4ll address: %m");
link_enter_failed(link);
} else if (r >= 0)
link_rtnl_process_address(rtnl, m, link->manager);