Saves a few bytes.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
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;
}
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;
}
{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;
}
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;
}
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;
}
// 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;
}
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;
}
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;
}
{
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;
}
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);
// 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;
}
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);
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;
}