From 6099b3b56956322567323c11fd698b2328c6826b Mon Sep 17 00:00:00 2001 From: ajs Date: Sat, 20 Nov 2004 02:06:59 +0000 Subject: 2004-11-19 Andrew J. Schorr * global: Replace strerror with safe_strerror. And vtysh/vtysh.c needs to include "log.h" to pick up the declaration. --- zebra/if_ioctl.c | 14 +++++++------- zebra/if_ioctl_solaris.c | 14 +++++++------- zebra/if_proc.c | 6 +++--- zebra/if_sysctl.c | 8 ++++---- zebra/interface.c | 12 ++++++------ zebra/ioctl_solaris.c | 2 +- zebra/ipforward_proc.c | 24 ++++++++++++------------ zebra/ipforward_solaris.c | 6 +++--- zebra/irdp_interface.c | 2 +- zebra/irdp_main.c | 10 +++++----- zebra/irdp_packet.c | 10 +++++----- zebra/kernel_socket.c | 4 ++-- zebra/rt_ioctl.c | 8 ++++---- zebra/rt_netlink.c | 26 +++++++++++++------------- zebra/rtadv.c | 14 +++++++------- zebra/rtread_getmsg.c | 10 +++++----- zebra/rtread_proc.c | 4 ++-- zebra/rtread_sysctl.c | 4 ++-- zebra/zserv.c | 8 ++++---- 19 files changed, 93 insertions(+), 93 deletions(-) (limited to 'zebra') diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c index 431e7ea1..90f18e28 100644 --- a/zebra/if_ioctl.c +++ b/zebra/if_ioctl.c @@ -50,7 +50,7 @@ interface_list_ioctl () sock = socket (AF_INET, SOCK_DGRAM, 0); if (sock < 0) { - zlog_warn ("Can't make AF_INET socket stream: %s", strerror (errno)); + zlog_warn ("Can't make AF_INET socket stream: %s", safe_strerror (errno)); return -1; } @@ -79,7 +79,7 @@ interface_list_ioctl () if (ret < 0) { - zlog_warn ("SIOCGIFCONF: %s", strerror(errno)); + zlog_warn ("SIOCGIFCONF: %s", safe_strerror(errno)); goto end; } /* Repeatedly get info til buffer fails to grow. */ @@ -218,7 +218,7 @@ if_getaddrs () ret = getifaddrs (&ifap); if (ret != 0) { - zlog_err ("getifaddrs(): %s", strerror (errno)); + zlog_err ("getifaddrs(): %s", safe_strerror (errno)); return -1; } @@ -334,7 +334,7 @@ if_get_addr (struct interface *ifp) { if (errno != EADDRNOTAVAIL) { - zlog_warn ("SIOCGIFADDR fail: %s", strerror (errno)); + zlog_warn ("SIOCGIFADDR fail: %s", safe_strerror (errno)); return ret; } return 0; @@ -347,7 +347,7 @@ if_get_addr (struct interface *ifp) { if (errno != EADDRNOTAVAIL) { - zlog_warn ("SIOCGIFNETMASK fail: %s", strerror (errno)); + zlog_warn ("SIOCGIFNETMASK fail: %s", safe_strerror (errno)); return ret; } return 0; @@ -369,7 +369,7 @@ if_get_addr (struct interface *ifp) { if (errno != EADDRNOTAVAIL) { - zlog_warn ("SIOCGIFDSTADDR fail: %s", strerror (errno)); + zlog_warn ("SIOCGIFDSTADDR fail: %s", safe_strerror (errno)); return ret; } return 0; @@ -384,7 +384,7 @@ if_get_addr (struct interface *ifp) { if (errno != EADDRNOTAVAIL) { - zlog_warn ("SIOCGIFBRDADDR fail: %s", strerror (errno)); + zlog_warn ("SIOCGIFBRDADDR fail: %s", safe_strerror (errno)); return ret; } return 0; diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c index 4f8284a3..1cbf555e 100644 --- a/zebra/if_ioctl_solaris.c +++ b/zebra/if_ioctl_solaris.c @@ -60,7 +60,7 @@ interface_list_ioctl (int af) if (sock < 0) { zlog_warn ("Can't make %s socket stream: %s", - (af == AF_INET ? "AF_INET" : "AF_INET6"), strerror (errno)); + (af == AF_INET ? "AF_INET" : "AF_INET6"), safe_strerror (errno)); if (zserv_privs.change(ZPRIVS_LOWER)) zlog (NULL, LOG_ERR, "Can't lower privileges"); @@ -79,7 +79,7 @@ calculate_lifc_len: /* must hold privileges to enter here */ if (ret < 0) { zlog_warn ("interface_list_ioctl: SIOCGLIFNUM failed %s", - strerror (errno)); + safe_strerror (errno)); close (sock); return -1; } @@ -120,7 +120,7 @@ calculate_lifc_len: /* must hold privileges to enter here */ if (errno == EINVAL) goto calculate_lifc_len; /* deliberately hold privileges */ - zlog_warn ("SIOCGLIFCONF: %s", strerror (errno)); + zlog_warn ("SIOCGLIFCONF: %s", safe_strerror (errno)); if (zserv_privs.change(ZPRIVS_LOWER)) zlog (NULL, LOG_ERR, "Can't lower privileges"); @@ -232,7 +232,7 @@ if_get_addr (struct interface *ifp, struct sockaddr *addr) if (ret < 0) { zlog_warn ("SIOCGLIFDSTADDR (%s) fail: %s", - ifp->name, strerror (errno)); + ifp->name, safe_strerror (errno)); return ret; } memcpy (&dest, &lifreq.lifr_dstaddr, ADDRLEN (addr)); @@ -251,7 +251,7 @@ if_get_addr (struct interface *ifp, struct sockaddr *addr) if (errno != EADDRNOTAVAIL) { zlog_warn ("SIOCGLIFNETMASK (%s) fail: %s", ifp->name, - strerror (errno)); + safe_strerror (errno)); return ret; } return 0; @@ -267,7 +267,7 @@ if_get_addr (struct interface *ifp, struct sockaddr *addr) if (errno != EADDRNOTAVAIL) { zlog_warn ("SIOCGLIFBRDADDR (%s) fail: %s", - ifp->name, strerror (errno)); + ifp->name, safe_strerror (errno)); return ret; } return 0; @@ -289,7 +289,7 @@ if_get_addr (struct interface *ifp, struct sockaddr *addr) if (ret < 0) { zlog_warn ("SIOCGLIFSUBNET (%s) fail: %s", - ifp->name, strerror (errno)); + ifp->name, safe_strerror (errno)); } else { diff --git a/zebra/if_proc.c b/zebra/if_proc.c index 6c47d430..199a8e70 100644 --- a/zebra/if_proc.c +++ b/zebra/if_proc.c @@ -138,7 +138,7 @@ ifstat_update_proc () if (fp == NULL) { zlog_warn ("Can't open proc file %s: %s", - _PATH_PROC_NET_DEV, strerror (errno)); + _PATH_PROC_NET_DEV, safe_strerror (errno)); return -1; } @@ -179,7 +179,7 @@ interface_list_proc () if (fp == NULL) { zlog_warn ("Can't open proc file %s: %s", - _PATH_PROC_NET_DEV, strerror (errno)); + _PATH_PROC_NET_DEV, safe_strerror (errno)); return -1; } @@ -222,7 +222,7 @@ ifaddr_proc_ipv6 () if (fp == NULL) { zlog_warn ("Can't open proc file %s: %s", - _PATH_PROC_NET_IF_INET6, strerror (errno)); + _PATH_PROC_NET_IF_INET6, safe_strerror (errno)); return -1; } diff --git a/zebra/if_sysctl.c b/zebra/if_sysctl.c index 1441dfcc..7ad570f4 100644 --- a/zebra/if_sysctl.c +++ b/zebra/if_sysctl.c @@ -52,7 +52,7 @@ ifstat_update_sysctl () /* Query buffer size. */ if (sysctl (mib, MIBSIZ, NULL, &bufsiz, NULL, 0) < 0) { - zlog_warn ("sysctl() error by %s", strerror (errno)); + zlog_warn ("sysctl() error by %s", safe_strerror (errno)); return -1; } @@ -62,7 +62,7 @@ ifstat_update_sysctl () /* Fetch interface informations into allocated buffer. */ if (sysctl (mib, MIBSIZ, buf, &bufsiz, NULL, 0) < 0) { - zlog (NULL, LOG_WARNING, "sysctl error by %s", strerror (errno)); + zlog (NULL, LOG_WARNING, "sysctl error by %s", safe_strerror (errno)); return -1; } @@ -108,7 +108,7 @@ interface_list () /* Query buffer size. */ if (sysctl (mib, MIBSIZ, NULL, &bufsiz, NULL, 0) < 0) { - zlog (NULL, LOG_WARNING, "sysctl() error by %s", strerror (errno)); + zlog (NULL, LOG_WARNING, "sysctl() error by %s", safe_strerror (errno)); return; } @@ -118,7 +118,7 @@ interface_list () /* Fetch interface informations into allocated buffer. */ if (sysctl (mib, MIBSIZ, buf, &bufsiz, NULL, 0) < 0) { - zlog (NULL, LOG_WARNING, "sysctl error by %s", strerror (errno)); + zlog (NULL, LOG_WARNING, "sysctl error by %s", safe_strerror (errno)); return; } diff --git a/zebra/interface.c b/zebra/interface.c index 813adb84..f97dc3fd 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -234,7 +234,7 @@ if_addr_wakeup (struct interface *ifp) if (ret < 0) { zlog_warn ("Can't set interface's address: %s", - strerror(errno)); + safe_strerror(errno)); continue; } @@ -261,7 +261,7 @@ if_addr_wakeup (struct interface *ifp) if (ret < 0) { zlog_warn ("Can't set interface's address: %s", - strerror(errno)); + safe_strerror(errno)); continue; } SET_FLAG (ifc->conf, ZEBRA_IFC_REAL); @@ -1163,7 +1163,7 @@ ip_address_install (struct vty *vty, struct interface *ifp, if (ret < 0) { vty_out (vty, "%% Can't set interface IP address: %s.%s", - strerror(errno), VTY_NEWLINE); + safe_strerror(errno), VTY_NEWLINE); return CMD_WARNING; } @@ -1227,7 +1227,7 @@ ip_address_uninstall (struct vty *vty, struct interface *ifp, if (ret < 0) { vty_out (vty, "%% Can't unset interface IP address: %s.%s", - strerror(errno), VTY_NEWLINE); + safe_strerror(errno), VTY_NEWLINE); return CMD_WARNING; } @@ -1355,7 +1355,7 @@ ipv6_address_install (struct vty *vty, struct interface *ifp, if (ret < 0) { vty_out (vty, "%% Can't set interface IP address: %s.%s", - strerror(errno), VTY_NEWLINE); + safe_strerror(errno), VTY_NEWLINE); return CMD_WARNING; } @@ -1416,7 +1416,7 @@ ipv6_address_uninstall (struct vty *vty, struct interface *ifp, if (ret < 0) { vty_out (vty, "%% Can't unset interface IP address: %s.%s", - strerror(errno), VTY_NEWLINE); + safe_strerror(errno), VTY_NEWLINE); return CMD_WARNING; } diff --git a/zebra/ioctl_solaris.c b/zebra/ioctl_solaris.c index 7b4dde36..8ebd0f41 100644 --- a/zebra/ioctl_solaris.c +++ b/zebra/ioctl_solaris.c @@ -331,7 +331,7 @@ if_set_flags (struct interface *ifp, unsigned long flags) if (ret < 0) zlog_info ("can't set interface flags on %s: %s", ifp->name, - strerror (errno)); + safe_strerror (errno)); else ret = 0; diff --git a/zebra/ipforward_proc.c b/zebra/ipforward_proc.c index 4c30cf67..443cb1c6 100644 --- a/zebra/ipforward_proc.c +++ b/zebra/ipforward_proc.c @@ -77,13 +77,13 @@ ipforward_on () FILE *fp; if ( zserv_privs.change(ZPRIVS_RAISE) ) - zlog_err ("Can't raise privileges, %s", strerror (errno) ); + zlog_err ("Can't raise privileges, %s", safe_strerror (errno) ); fp = fopen (proc_ipv4_forwarding, "w"); if (fp == NULL) { if ( zserv_privs.change(ZPRIVS_LOWER) ) - zlog_err ("Can't lower privileges, %s", strerror (errno)); + zlog_err ("Can't lower privileges, %s", safe_strerror (errno)); return -1; } @@ -92,7 +92,7 @@ ipforward_on () fclose (fp); if ( zserv_privs.change(ZPRIVS_LOWER) ) - zlog_err ("Can't lower privileges, %s", strerror (errno)); + zlog_err ("Can't lower privileges, %s", safe_strerror (errno)); return ipforward (); } @@ -103,13 +103,13 @@ ipforward_off () FILE *fp; if ( zserv_privs.change(ZPRIVS_RAISE) ) - zlog_err ("Can't raise privileges, %s", strerror (errno)); + zlog_err ("Can't raise privileges, %s", safe_strerror (errno)); fp = fopen (proc_ipv4_forwarding, "w"); if (fp == NULL) { if ( zserv_privs.change(ZPRIVS_LOWER) ) - zlog_err ("Can't lower privileges, %s", strerror (errno)); + zlog_err ("Can't lower privileges, %s", safe_strerror (errno)); return -1; } @@ -118,7 +118,7 @@ ipforward_off () fclose (fp); if ( zserv_privs.change(ZPRIVS_LOWER) ) - zlog_err ("Can't lower privileges, %s", strerror (errno)); + zlog_err ("Can't lower privileges, %s", safe_strerror (errno)); return ipforward (); } @@ -150,13 +150,13 @@ ipforward_ipv6_on () FILE *fp; if ( zserv_privs.change(ZPRIVS_RAISE) ) - zlog_err ("Can't raise privileges, %s", strerror (errno)); + zlog_err ("Can't raise privileges, %s", safe_strerror (errno)); fp = fopen (proc_ipv6_forwarding, "w"); if (fp == NULL) { if ( zserv_privs.change(ZPRIVS_LOWER) ) - zlog_err ("Can't lower privileges, %s", strerror (errno)); + zlog_err ("Can't lower privileges, %s", safe_strerror (errno)); return -1; } @@ -165,7 +165,7 @@ ipforward_ipv6_on () fclose (fp); if ( zserv_privs.change(ZPRIVS_LOWER) ) - zlog_err ("Can't lower privileges, %s", strerror (errno)); + zlog_err ("Can't lower privileges, %s", safe_strerror (errno)); return ipforward_ipv6 (); } @@ -176,13 +176,13 @@ ipforward_ipv6_off () FILE *fp; if ( zserv_privs.change(ZPRIVS_RAISE) ) - zlog_err ("Can't raise privileges, %s", strerror (errno)); + zlog_err ("Can't raise privileges, %s", safe_strerror (errno)); fp = fopen (proc_ipv6_forwarding, "w"); if (fp == NULL) { if ( zserv_privs.change(ZPRIVS_LOWER) ) - zlog_err ("Can't lower privileges, %s", strerror (errno)); + zlog_err ("Can't lower privileges, %s", safe_strerror (errno)); return -1; } @@ -191,7 +191,7 @@ ipforward_ipv6_off () fclose (fp); if ( zserv_privs.change(ZPRIVS_LOWER) ) - zlog_err ("Can't lower privileges, %s", strerror (errno)); + zlog_err ("Can't lower privileges, %s", safe_strerror (errno)); return ipforward_ipv6 (); } diff --git a/zebra/ipforward_solaris.c b/zebra/ipforward_solaris.c index 8d6fd98b..2eaf3416 100644 --- a/zebra/ipforward_solaris.c +++ b/zebra/ipforward_solaris.c @@ -80,7 +80,7 @@ solaris_nd(const int cmd, const char* parameter, const int value) zlog_err ("solaris_nd: Can't raise privileges"); if ((fd = open (device, O_RDWR)) < 0) { - zlog_warn("failed to open device %s - %s", device, strerror(errno)); + zlog_warn("failed to open device %s - %s", device, safe_strerror(errno)); if ( zserv_privs.change (ZPRIVS_LOWER) ) zlog_err ("solaris_nd: Can't lower privileges"); return -1; @@ -90,7 +90,7 @@ solaris_nd(const int cmd, const char* parameter, const int value) if ( zserv_privs.change (ZPRIVS_LOWER) ) zlog_err ("solaris_nd: Can't lower privileges"); close (fd); - zlog_warn("ioctl I_STR failed on device %s - %s", device,strerror(errno)); + zlog_warn("ioctl I_STR failed on device %s - %s", device,safe_strerror(errno)); return -1; } close(fd); @@ -104,7 +104,7 @@ solaris_nd(const int cmd, const char* parameter, const int value) if (errno) { zlog_warn("failed to convert returned value to integer - %s", - strerror(errno)); + safe_strerror(errno)); retval = -1; } } diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index e824abed..d6fd1c59 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -116,7 +116,7 @@ int if_group (struct interface *ifp, zlog_warn ("IRDP: %s can't setsockopt %s: %s", add_leave == IP_ADD_MEMBERSHIP? "join group":"leave group", inet_2a(group, b1), - strerror (errno)); + safe_strerror (errno)); return ret; } diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index 7b916969..8f0250bf 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -104,16 +104,16 @@ irdp_sock_init (void) if ( zserv_privs.change (ZPRIVS_RAISE) ) zlog_err ("irdp_sock_init: could not raise privs, %s", - strerror (errno) ); + safe_strerror (errno) ); irdp_sock = socket (AF_INET, SOCK_RAW, IPPROTO_ICMP); if ( zserv_privs.change (ZPRIVS_LOWER) ) zlog_err ("irdp_sock_init: could not lower privs, %s", - strerror (errno) ); + safe_strerror (errno) ); if (irdp_sock < 0) { - zlog_warn ("IRDP: can't create irdp socket %s", strerror(errno)); + zlog_warn ("IRDP: can't create irdp socket %s", safe_strerror(errno)); return irdp_sock; }; @@ -121,13 +121,13 @@ irdp_sock_init (void) ret = setsockopt (irdp_sock, IPPROTO_IP, IP_TTL, (void *) &i, sizeof (i)); if (ret < 0) { - zlog_warn ("IRDP: can't do irdp sockopt %s", strerror(errno)); + zlog_warn ("IRDP: can't do irdp sockopt %s", safe_strerror(errno)); return ret; }; ret = setsockopt_ifindex (AF_INET, irdp_sock, 1); if (ret < 0) { - zlog_warn ("IRDP: can't do irdp sockopt %s", strerror(errno)); + zlog_warn ("IRDP: can't do irdp sockopt %s", safe_strerror(errno)); return ret; }; diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c index 60604353..d78348cd 100644 --- a/zebra/irdp_packet.c +++ b/zebra/irdp_packet.c @@ -206,7 +206,7 @@ int irdp_recvmsg (int sock, u_char *buf, int size, int *ifindex) ret = recvmsg (sock, &msg, 0); if (ret < 0) { - zlog_warn("IRDP: recvmsg: read error %s", strerror(errno)); + zlog_warn("IRDP: recvmsg: read error %s", safe_strerror(errno)); return ret; } @@ -316,21 +316,21 @@ send_packet(struct interface *ifp, on = 1; if (setsockopt(irdp_sock, IPPROTO_IP, IP_HDRINCL, (char *) &on, sizeof(on)) < 0) - zlog_warn("sendto %s", strerror (errno)); + zlog_warn("sendto %s", safe_strerror (errno)); if(dst == INADDR_BROADCAST ) { on = 1; if (setsockopt(irdp_sock, SOL_SOCKET, SO_BROADCAST, (char *) &on, sizeof(on)) < 0) - zlog_warn("sendto %s", strerror (errno)); + zlog_warn("sendto %s", safe_strerror (errno)); } if(dst != INADDR_BROADCAST) { on = 0; if( setsockopt(irdp_sock,IPPROTO_IP, IP_MULTICAST_LOOP, (char *)&on,sizeof(on)) < 0) - zlog_warn("sendto %s", strerror (errno)); + zlog_warn("sendto %s", safe_strerror (errno)); } bzero(&sockdst,sizeof(sockdst)); @@ -359,7 +359,7 @@ send_packet(struct interface *ifp, sockopt_iphdrincl_swab_htosys (ip); if (sendmsg(irdp_sock, msg, 0) < 0) { - zlog_warn("sendto %s", strerror (errno)); + zlog_warn("sendto %s", safe_strerror (errno)); } /* printf("TX on %s idx %d\n", ifp->name, ifp->ifindex); */ } diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index 27b88957..60542c61 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -798,7 +798,7 @@ rtm_write (int message, if (errno == ENETUNREACH) return ZEBRA_ERR_RTUNREACH; - zlog_warn ("write : %s (%d)", strerror (errno), errno); + zlog_warn ("write : %s (%d)", safe_strerror (errno), errno); return -1; } return 0; @@ -896,7 +896,7 @@ kernel_read (struct thread *thread) if (nbytes <= 0) { if (nbytes < 0 && errno != EWOULDBLOCK && errno != EAGAIN) - zlog_warn ("routing socket error: %s", strerror (errno)); + zlog_warn ("routing socket error: %s", safe_strerror (errno)); return 0; } diff --git a/zebra/rt_ioctl.c b/zebra/rt_ioctl.c index d470572b..34840104 100644 --- a/zebra/rt_ioctl.c +++ b/zebra/rt_ioctl.c @@ -151,7 +151,7 @@ kernel_add_route (struct prefix_ipv4 *dest, struct in_addr *gate, } close (sock); - zlog_warn ("write : %s (%d)", strerror (errno), errno); + zlog_warn ("write : %s (%d)", safe_strerror (errno), errno); return 1; } close (sock); @@ -326,7 +326,7 @@ kernel_ioctl_ipv4 (u_long cmd, struct prefix *p, struct rib *rib, int family) } close (sock); - zlog_warn ("write : %s (%d)", strerror (errno), errno); + zlog_warn ("write : %s (%d)", safe_strerror (errno), errno); return ret; } close (sock); @@ -411,7 +411,7 @@ kernel_ioctl_ipv6 (u_long type, struct prefix_ipv6 *dest, struct in6_addr *gate, if (ret < 0) { zlog_warn ("can't %s ipv6 route: %s\n", type == SIOCADDRT ? "add" : "delete", - strerror(errno)); + safe_strerror(errno)); ret = errno; close (sock); return ret; @@ -526,7 +526,7 @@ kernel_ioctl_ipv6_multipath (u_long cmd, struct prefix *p, struct rib *rib, { zlog_warn ("can't %s ipv6 route: %s\n", cmd == SIOCADDRT ? "add" : "delete", - strerror(errno)); + safe_strerror(errno)); ret = errno; close (sock); return ret; diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 50e83b77..eb31e6cd 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -99,7 +99,7 @@ netlink_socket (struct nlsock *nl, unsigned long groups) if (sock < 0) { zlog (NULL, LOG_ERR, "Can't open %s socket: %s", nl->name, - strerror (errno)); + safe_strerror (errno)); return -1; } @@ -107,7 +107,7 @@ netlink_socket (struct nlsock *nl, unsigned long groups) if (ret < 0) { zlog (NULL, LOG_ERR, "Can't set %s socket flags: %s", nl->name, - strerror (errno)); + safe_strerror (errno)); close (sock); return -1; } @@ -125,7 +125,7 @@ netlink_socket (struct nlsock *nl, unsigned long groups) if (ret < 0) { zlog (NULL, LOG_ERR, "Can't get %s receive buffer size: %s", nl->name, - strerror (errno)); + safe_strerror (errno)); close (sock); return -1; } @@ -135,7 +135,7 @@ netlink_socket (struct nlsock *nl, unsigned long groups) if (ret < 0) { zlog (NULL, LOG_ERR, "Can't set %s receive buffer size: %s", nl->name, - strerror (errno)); + safe_strerror (errno)); close (sock); return -1; } @@ -144,7 +144,7 @@ netlink_socket (struct nlsock *nl, unsigned long groups) if (ret < 0) { zlog (NULL, LOG_ERR, "Can't get %s receive buffer size: %s", nl->name, - strerror (errno)); + safe_strerror (errno)); close (sock); return -1; } @@ -172,7 +172,7 @@ netlink_socket (struct nlsock *nl, unsigned long groups) if (ret < 0) { zlog (NULL, LOG_ERR, "Can't bind %s socket to group 0x%x: %s", - nl->name, snl.nl_groups, strerror (errno)); + nl->name, snl.nl_groups, safe_strerror (errno)); close (sock); return -1; } @@ -183,7 +183,7 @@ netlink_socket (struct nlsock *nl, unsigned long groups) if (ret < 0 || namelen != sizeof snl) { zlog (NULL, LOG_ERR, "Can't get %s socket name: %s", nl->name, - strerror (errno)); + safe_strerror (errno)); close (sock); return -1; } @@ -201,14 +201,14 @@ set_netlink_blocking (struct nlsock *nl, int *flags) if ((*flags = fcntl (nl->sock, F_GETFL, 0)) < 0) { zlog (NULL, LOG_ERR, "%s:%i F_GETFL error: %s", - __FUNCTION__, __LINE__, strerror (errno)); + __FUNCTION__, __LINE__, safe_strerror (errno)); return -1; } *flags &= ~O_NONBLOCK; if (fcntl (nl->sock, F_SETFL, *flags) < 0) { zlog (NULL, LOG_ERR, "%s:%i F_SETFL error: %s", - __FUNCTION__, __LINE__, strerror (errno)); + __FUNCTION__, __LINE__, safe_strerror (errno)); return -1; } return 0; @@ -222,7 +222,7 @@ set_netlink_nonblocking (struct nlsock *nl, int *flags) if (fcntl (nl->sock, F_SETFL, *flags) < 0) { zlog (NULL, LOG_ERR, "%s:%i F_SETFL error: %s", - __FUNCTION__, __LINE__, strerror (errno)); + __FUNCTION__, __LINE__, safe_strerror (errno)); return -1; } return 0; @@ -277,7 +277,7 @@ netlink_request (int family, int type, struct nlsock *nl) if (ret < 0) { zlog (NULL, LOG_ERR, "%s sendto failed: %s", nl->name, - strerror (errno)); + safe_strerror (errno)); return -1; } @@ -392,7 +392,7 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *), zlog (NULL, loglvl, "%s error: %s, type=%s(%u), " "seq=%u, pid=%d", - nl->name, strerror (-errnum), + nl->name, safe_strerror (-errnum), lookup (nlmsg_str, msg_type), msg_type, err->msg.nlmsg_seq, err->msg.nlmsg_pid); } @@ -1227,7 +1227,7 @@ netlink_talk (struct nlmsghdr *n, struct nlsock *nl) if (status < 0) { zlog (NULL, LOG_ERR, "netlink_talk sendmsg() error: %s", - strerror (errno)); + safe_strerror (errno)); return -1; } diff --git a/zebra/rtadv.c b/zebra/rtadv.c index cb29a67e..770f975b 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -301,7 +301,7 @@ rtadv_send_packet (int sock, struct interface *ifp) if (ret < 0) { zlog_err ("rtadv_send_packet: sendmsg %d (%s)\n", - errno, strerror(errno)); + errno, safe_strerror(errno)); } } @@ -425,7 +425,7 @@ rtadv_read (struct thread *thread) if (len < 0) { - zlog_warn ("router solicitation recv failed: %s.", strerror (errno)); + zlog_warn ("router solicitation recv failed: %s.", safe_strerror (errno)); return len; } @@ -443,13 +443,13 @@ rtadv_make_socket (void) if ( zserv_privs.change (ZPRIVS_RAISE) ) zlog_err ("rtadv_make_socket: could not raise privs, %s", - strerror (errno) ); + safe_strerror (errno) ); sock = socket (AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); if ( zserv_privs.change (ZPRIVS_LOWER) ) zlog_err ("rtadv_make_socket: could not lower privs, %s", - strerror (errno) ); + safe_strerror (errno) ); /* When we can't make ICMPV6 socket simply back. Router advertisement feature will not be supported. */ @@ -480,7 +480,7 @@ rtadv_make_socket (void) sizeof (struct icmp6_filter)); if (ret < 0) { - zlog_info ("ICMP6_FILTER set fail: %s", strerror (errno)); + zlog_info ("ICMP6_FILTER set fail: %s", safe_strerror (errno)); return ret; } @@ -1223,7 +1223,7 @@ if_join_all_router (int sock, struct interface *ifp) ret = setsockopt (sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, (char *) &mreq, sizeof mreq); if (ret < 0) - zlog_warn ("can't setsockopt IPV6_JOIN_GROUP: %s", strerror (errno)); + zlog_warn ("can't setsockopt IPV6_JOIN_GROUP: %s", safe_strerror (errno)); zlog_info ("rtadv: %s join to all-routers multicast group", ifp->name); @@ -1244,7 +1244,7 @@ if_leave_all_router (int sock, struct interface *ifp) ret = setsockopt (sock, IPPROTO_IPV6, IPV6_LEAVE_GROUP, (char *) &mreq, sizeof mreq); if (ret < 0) - zlog_warn ("can't setsockopt IPV6_LEAVE_GROUP: %s", strerror (errno)); + zlog_warn ("can't setsockopt IPV6_LEAVE_GROUP: %s", safe_strerror (errno)); zlog_info ("rtadv: %s leave from all-routers multicast group", ifp->name); diff --git a/zebra/rtread_getmsg.c b/zebra/rtread_getmsg.c index 435eed80..ff6d7bc0 100644 --- a/zebra/rtread_getmsg.c +++ b/zebra/rtread_getmsg.c @@ -108,7 +108,7 @@ void route_read () if ((dev = open (_PATH_GETMSG_ROUTE, O_RDWR)) == -1) { zlog_warn ("can't open %s: %s", _PATH_GETMSG_ROUTE, - strerror (errno)); + safe_strerror (errno)); return; } @@ -129,7 +129,7 @@ void route_read () flags = 0; if (putmsg (dev, &msgdata, NULL, flags) == -1) { - zlog_warn ("putmsg failed: %s", strerror (errno)); + zlog_warn ("putmsg failed: %s", safe_strerror (errno)); goto exit; } @@ -141,7 +141,7 @@ void route_read () retval = getmsg (dev, &msgdata, NULL, &flags); if (retval == -1) { - zlog_warn ("getmsg(ctl) failed: %s", strerror (errno)); + zlog_warn ("getmsg(ctl) failed: %s", safe_strerror (errno)); goto exit; } @@ -156,7 +156,7 @@ void route_read () if (msgdata.len >= sizeof (struct T_error_ack) && TLIerr->PRIM_type == T_ERROR_ACK) { zlog_warn ("getmsg(ctl) returned T_ERROR_ACK: %s", - strerror ((TLIerr->TLI_error == TSYSERR) + safe_strerror ((TLIerr->TLI_error == TSYSERR) ? TLIerr->UNIX_error : EPROTO)); break; } @@ -196,7 +196,7 @@ void route_read () if (retval == -1) { zlog_warn ("getmsg(data) failed: %s", - strerror (errno)); + safe_strerror (errno)); goto exit; } diff --git a/zebra/rtread_proc.c b/zebra/rtread_proc.c index 320152e7..6e021c32 100644 --- a/zebra/rtread_proc.c +++ b/zebra/rtread_proc.c @@ -56,7 +56,7 @@ proc_route_read () fp = fopen (_PATH_PROCNET_ROUTE, "r"); if (fp == NULL) { - zlog_warn ("Can't open %s : %s\n", _PATH_PROCNET_ROUTE, strerror (errno)); + zlog_warn ("Can't open %s : %s\n", _PATH_PROCNET_ROUTE, safe_strerror (errno)); return -1; } @@ -111,7 +111,7 @@ proc_ipv6_route_read () if (fp == NULL) { zlog_warn ("Can't open %s : %s", _PATH_PROCNET_ROUTE6, - strerror (errno)); + safe_strerror (errno)); return -1; } diff --git a/zebra/rtread_sysctl.c b/zebra/rtread_sysctl.c index 970c0aa1..78864f2b 100644 --- a/zebra/rtread_sysctl.c +++ b/zebra/rtread_sysctl.c @@ -48,7 +48,7 @@ route_read () /* Get buffer size. */ if (sysctl (mib, MIBSIZ, NULL, &bufsiz, NULL, 0) < 0) { - zlog_warn ("sysctl fail: %s", strerror (errno)); + zlog_warn ("sysctl fail: %s", safe_strerror (errno)); return -1; } @@ -58,7 +58,7 @@ route_read () /* Read routing table information by calling sysctl(). */ if (sysctl (mib, MIBSIZ, buf, &bufsiz, NULL, 0) < 0) { - zlog_warn ("sysctl() fail by %s", strerror (errno)); + zlog_warn ("sysctl() fail by %s", safe_strerror (errno)); return -1; } diff --git a/zebra/zserv.c b/zebra/zserv.c index 10dd5fa5..09dddf63 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -1369,7 +1369,7 @@ zebra_accept (struct thread *thread) if (client_sock < 0) { - zlog_warn ("Can't accept zebra socket: %s", strerror (errno)); + zlog_warn ("Can't accept zebra socket: %s", safe_strerror (errno)); return -1; } @@ -1400,7 +1400,7 @@ zebra_serv () if (accept_sock < 0) { - zlog_warn ("Can't bind to socket: %s", strerror (errno)); + zlog_warn ("Can't bind to socket: %s", safe_strerror (errno)); zlog_warn ("zebra can't provice full functionality due to above error"); return; } @@ -1423,7 +1423,7 @@ zebra_serv () sizeof (struct sockaddr_in)); if (ret < 0) { - zlog_warn ("Can't bind to socket: %s", strerror (errno)); + zlog_warn ("Can't bind to socket: %s", safe_strerror (errno)); zlog_warn ("zebra can't provice full functionality due to above error"); close (accept_sock); /* Avoid sd leak. */ return; @@ -1435,7 +1435,7 @@ zebra_serv () ret = listen (accept_sock, 1); if (ret < 0) { - zlog_warn ("Can't listen to socket: %s", strerror (errno)); + zlog_warn ("Can't listen to socket: %s", safe_strerror (errno)); zlog_warn ("zebra can't provice full functionality due to above error"); close (accept_sock); /* Avoid sd leak. */ return; -- cgit v1.2.1