summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-11-27 08:18:18 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-11-27 14:35:20 +0900
commit5a9494bedbf9af3950d646d3acdfc93e17fdb567 (patch)
tree39c17f0d2cb40a8697e02e218d4ad7c3a7782fa7
parentd85ff94477b9b1e1b8f45f92eaa4eb8f834f6499 (diff)
downloadsystemd-5a9494bedbf9af3950d646d3acdfc93e17fdb567.tar.gz
network: use SYNTHETIC_ERRNO() macro
-rw-r--r--src/network/netdev/netdev.c6
-rw-r--r--src/network/networkd-can.c6
2 files changed, 4 insertions, 8 deletions
diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
index 71a4f603be..52c10b10ef 100644
--- a/src/network/netdev/netdev.c
+++ b/src/network/netdev/netdev.c
@@ -400,10 +400,8 @@ int netdev_set_ifindex(NetDev *netdev, sd_netlink_message *message) {
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not get rtnl message type: %m");
- if (type != RTM_NEWLINK) {
- log_netdev_error(netdev, "Cannot set ifindex from unexpected rtnl message type.");
- return -EINVAL;
- }
+ if (type != RTM_NEWLINK)
+ return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL), "Cannot set ifindex from unexpected rtnl message type.");
r = sd_rtnl_message_link_get_ifindex(message, &ifindex);
if (r < 0) {
diff --git a/src/network/networkd-can.c b/src/network/networkd-can.c
index 7e31d2fc82..8610320698 100644
--- a/src/network/networkd-can.c
+++ b/src/network/networkd-can.c
@@ -195,10 +195,8 @@ static int link_set_can(Link *link) {
format_timespan(time_string, FORMAT_TIMESPAN_MAX, restart_ms * 1000, MSEC_PER_SEC);
- if (restart_ms > UINT32_MAX) {
- log_link_error(link, "restart timeout (%s) too big.", time_string);
- return -ERANGE;
- }
+ if (restart_ms > UINT32_MAX)
+ return log_link_error_errno(link, SYNTHETIC_ERRNO(ERANGE), "restart timeout (%s) too big.", time_string);
log_link_debug(link, "Setting restart = %s", time_string);