diff options
author | Rosen Penev <rosenp@gmail.com> | 2017-12-16 19:55:04 -0800 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2017-12-17 20:02:02 +0100 |
commit | 7aa2594c5a127d92fa8f04328ac7b43e595bcaa7 (patch) | |
tree | 9dbfea93d259084641f30172efc65692d0540205 /src | |
parent | 750e457e3000187b85906814a2529ede24775325 (diff) |
odhcpd: Replace strerror(errno) with %m format
Saves a few bytes.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/config.c | 2 | ||||
-rw-r--r-- | src/dhcpv4.c | 6 | ||||
-rw-r--r-- | src/dhcpv6.c | 6 | ||||
-rw-r--r-- | src/ndp.c | 7 | ||||
-rw-r--r-- | src/netlink.c | 4 | ||||
-rw-r--r-- | src/odhcpd.c | 4 | ||||
-rw-r--r-- | src/router.c | 5 | ||||
-rw-r--r-- | src/ubus.c | 2 |
8 files changed, 15 insertions, 21 deletions
diff --git a/src/config.c b/src/config.c index 409b3b8..c3e2437 100644 --- a/src/config.c +++ b/src/config.c @@ -186,7 +186,7 @@ static int mkdir_p(char *dir, mode_t mask) return 0; if (ret) - syslog(LOG_ERR, "mkdir(%s, %d) failed: %s\n", dir, mask, strerror(errno)); + syslog(LOG_ERR, "mkdir(%s, %d) failed: %m\n", dir, mask); return ret; } diff --git a/src/dhcpv4.c b/src/dhcpv4.c index c367507..db5f138 100644 --- a/src/dhcpv4.c +++ b/src/dhcpv4.c @@ -86,8 +86,7 @@ int dhcpv4_setup_interface(struct interface *iface, bool enable) int sock = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP); if (sock < 0) { - syslog(LOG_ERR, "Failed to create DHCPv4 server socket: %s", - strerror(errno)); + syslog(LOG_ERR, "Failed to create DHCPv4 server socket: %m"); return -1; } @@ -110,8 +109,7 @@ int dhcpv4_setup_interface(struct interface *iface, bool enable) {INADDR_ANY}, {0}}; if (bind(sock, (struct sockaddr*)&bind_addr, sizeof(bind_addr))) { - syslog(LOG_ERR, "Failed to open DHCPv4 server socket: %s", - strerror(errno)); + syslog(LOG_ERR, "Failed to open DHCPv4 server socket: %m"); return -1; } diff --git a/src/dhcpv6.c b/src/dhcpv6.c index 462a85e..e092c10 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -53,8 +53,7 @@ int dhcpv6_setup_interface(struct interface *iface, bool enable) if (enable && iface->dhcpv6) { int sock = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP); if (sock < 0) { - syslog(LOG_ERR, "Failed to create DHCPv6 server socket: %s", - strerror(errno)); + syslog(LOG_ERR, "Failed to create DHCPv6 server socket: %m"); return -1; } @@ -76,8 +75,7 @@ int dhcpv6_setup_interface(struct interface *iface, bool enable) 0, IN6ADDR_ANY_INIT, 0}; if (bind(sock, (struct sockaddr*)&bind_addr, sizeof(bind_addr))) { - syslog(LOG_ERR, "Failed to open DHCPv6 server socket: %s", - strerror(errno)); + syslog(LOG_ERR, "Failed to open DHCPv6 server socket: %m"); return -1; } @@ -62,7 +62,7 @@ int ndp_init(void) // Open ICMPv6 socket ping_socket = socket(AF_INET6, SOCK_RAW | SOCK_CLOEXEC, IPPROTO_ICMPV6); if (ping_socket < 0) { - syslog(LOG_ERR, "Unable to open raw socket: %s", strerror(errno)); + syslog(LOG_ERR, "Unable to open raw socket: %m"); return -1; } @@ -113,8 +113,7 @@ int ndp_setup_interface(struct interface *iface, bool enable) int sock = socket(AF_PACKET, SOCK_DGRAM | SOCK_CLOEXEC, htons(ETH_P_IPV6)); if (sock < 0) { - syslog(LOG_ERR, "Unable to open packet socket: %s", - strerror(errno)); + syslog(LOG_ERR, "Unable to open packet socket: %m"); ret = -1; goto out; } @@ -126,7 +125,7 @@ int ndp_setup_interface(struct interface *iface, bool enable) if (setsockopt(sock, SOL_SOCKET, SO_ATTACH_FILTER, &bpf_prog, sizeof(bpf_prog))) { - syslog(LOG_ERR, "Failed to set BPF: %s", strerror(errno)); + syslog(LOG_ERR, "Failed to set BPF: %m"); ret = -1; goto out; } diff --git a/src/netlink.c b/src/netlink.c index ca9376e..e9fd04a 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -58,13 +58,13 @@ int netlink_init(void) { rtnl_socket = create_socket(NETLINK_ROUTE); if (!rtnl_socket) { - syslog(LOG_ERR, "Unable to open nl socket: %s", strerror(errno)); + syslog(LOG_ERR, "Unable to open nl socket: %m"); goto err; } rtnl_event.sock = create_socket(NETLINK_ROUTE); if (!rtnl_event.sock) { - syslog(LOG_ERR, "Unable to open nl event socket: %s", strerror(errno)); + syslog(LOG_ERR, "Unable to open nl event socket: %m"); goto err; } diff --git a/src/odhcpd.c b/src/odhcpd.c index 58c4338..71b803d 100644 --- a/src/odhcpd.c +++ b/src/odhcpd.c @@ -187,8 +187,8 @@ ssize_t odhcpd_send(int socket, struct sockaddr_in6 *dest, ssize_t sent = sendmsg(socket, &msg, MSG_DONTWAIT); if (sent < 0) - syslog(LOG_NOTICE, "Failed to send to %s%%%s (%s)", - ipbuf, iface->ifname, strerror(errno)); + syslog(LOG_NOTICE, "Failed to send to %s%%%s (%m)", + ipbuf, iface->ifname); else syslog(LOG_DEBUG, "Sent %li bytes to %s%%%s", (long)sent, ipbuf, iface->ifname); diff --git a/src/router.c b/src/router.c index 7bc94ed..e62282b 100644 --- a/src/router.c +++ b/src/router.c @@ -48,7 +48,7 @@ int router_init(void) // Open ICMPv6 socket int sock = socket(AF_INET6, SOCK_RAW | SOCK_CLOEXEC, IPPROTO_ICMPV6); if (sock < 0 && errno != EAFNOSUPPORT) { - syslog(LOG_ERR, "Failed to open RAW-socket: %s", strerror(errno)); + syslog(LOG_ERR, "Failed to open RAW-socket: %m"); return -1; } @@ -82,8 +82,7 @@ int router_init(void) odhcpd_register(&router_event); if (!(fp_route = fopen("/proc/net/ipv6_route", "r"))) - syslog(LOG_ERR, "Failed to open routing table: %s", - strerror(errno)); + syslog(LOG_ERR, "Failed to open routing table: %m"); netlink_add_netevent_handler(&router_netevent_handler); @@ -412,7 +412,7 @@ bool ubus_has_prefix(const char *name, const char *ifname) int ubus_init(void) { if (!(ubus = ubus_connect(NULL))) { - syslog(LOG_ERR, "Unable to connect to ubus: %s", strerror(errno)); + syslog(LOG_ERR, "Unable to connect to ubus: %m"); return -1; } |