From 6a7a4e4d0a057febab787a2d5d3e0b52d2db2268 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 21 Apr 2015 17:40:18 +0200 Subject: networkd: improve how networkd logs things This makes adds a couple of fixes: - Introduces log_netdev_error_errno() and friends, which takes an error number, and matches what log_link_error_errno() and friends do. - Replaces a lof ot strerror() usage with log_netdev_error_errno(), log_link_error_errno() and log_erro_errno() - Uppercases the first character of many log messages, after all this is supposed to be english language - Drops manual negating of error codes before passing them to log functions, the log functions all do that internally anyway. Some other minor fixes. Behaviour should not change really. --- src/network/networkd-network.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/network/networkd-network.c') diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 78bbf74bff..64c1b9cce1 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -425,8 +425,8 @@ int config_parse_netdev(const char *unit, r = hashmap_put(network->stacked_netdevs, netdev->ifname, netdev); if (r < 0) { log_syntax(unit, LOG_ERR, filename, line, EINVAL, - "Can not add VLAN '%s' to network: %s", - rvalue, strerror(-r)); + "Can not add VLAN '%s' to network: %m", + rvalue); return 0; } @@ -502,8 +502,7 @@ int config_parse_tunnel(const char *unit, r = netdev_get(network->manager, rvalue, &netdev); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, EINVAL, - "Tunnel is invalid, ignoring assignment: %s", rvalue); + log_syntax(unit, LOG_ERR, filename, line, r, "Tunnel is invalid, ignoring assignment: %s", rvalue); return 0; } @@ -523,9 +522,7 @@ int config_parse_tunnel(const char *unit, r = hashmap_put(network->stacked_netdevs, netdev->ifname, netdev); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, EINVAL, - "Can not add VLAN '%s' to network: %s", - rvalue, strerror(-r)); + log_syntax(unit, LOG_ERR, filename, line, r, "Cannot add VLAN '%s' to network, ignoring: %m", rvalue); return 0; } @@ -694,13 +691,13 @@ int config_parse_ipv6token( r = in_addr_from_string(AF_INET6, rvalue, &buffer); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, -r, "Failed to parse IPv6 token, ignoring: %s", rvalue); + log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse IPv6 token, ignoring: %s", rvalue); return 0; } r = in_addr_is_null(AF_INET6, &buffer); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, -r, "IPv6 token can not be the ANY address, ignoring: %s", rvalue); + log_syntax(unit, LOG_ERR, filename, line, r, "IPv6 token can not be the ANY address, ignoring: %s", rvalue); return 0; } -- cgit v1.2.3-54-g00ecf