]> git.proxmox.com Git - mirror_frr.git/commitdiff
2004-11-19 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
authorajs <ajs>
Sat, 20 Nov 2004 02:06:59 +0000 (02:06 +0000)
committerajs <ajs>
Sat, 20 Nov 2004 02:06:59 +0000 (02:06 +0000)
* global: Replace strerror with safe_strerror.  And vtysh/vtysh.c
  needs to include "log.h" to pick up the declaration.

50 files changed:
ChangeLog
bgpd/bgp_network.c
bgpd/bgp_packet.c
isisd/isis_network.c
isisd/modified/thread.c
isisd/modified/vty.c
lib/buffer.c
lib/command.c
lib/memory.c
lib/pid_output.c
lib/privs.c
lib/smux.c
lib/sockopt.c
lib/sockunion.c
lib/thread.c
lib/vty.c
ospf6d/ospf6_lsa.c
ospf6d/ospf6_network.c
ospf6d/ospf6_zebra.c
ospfclient/ospf_apiclient.c
ospfd/ospf_api.c
ospfd/ospf_apiserver.c
ospfd/ospf_network.c
ospfd/ospf_opaque.c
ospfd/ospf_packet.c
ospfd/ospf_te.c
ripd/rip_interface.c
ripd/ripd.c
ripngd/ripng_interface.c
ripngd/ripngd.c
vtysh/vtysh.c
zebra/if_ioctl.c
zebra/if_ioctl_solaris.c
zebra/if_proc.c
zebra/if_sysctl.c
zebra/interface.c
zebra/ioctl_solaris.c
zebra/ipforward_proc.c
zebra/ipforward_solaris.c
zebra/irdp_interface.c
zebra/irdp_main.c
zebra/irdp_packet.c
zebra/kernel_socket.c
zebra/rt_ioctl.c
zebra/rt_netlink.c
zebra/rtadv.c
zebra/rtread_getmsg.c
zebra/rtread_proc.c
zebra/rtread_sysctl.c
zebra/zserv.c

index 839e94c24096b36d1b4608188db2115f63b16a90..39e7458a6d513c99442ad94ad5eccb6423fdeab5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-11-19 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+       * global: Replace strerror with safe_strerror.  And vtysh/vtysh.c
+         needs to include "log.h" to pick up the declaration.
+
 2004-11-19 Hasso Tepper <hasso at quagga.net>
 
        * configure.ac: Avoid regeneration of doc/quagga.info for now.
index 84311e2ef74241c3cd4a861a47deae843fad49ef..7dcddb7987831f79d1ad7e358245b968e42ff8f6 100644 (file)
@@ -65,7 +65,7 @@ bgp_accept (struct thread *thread)
   bgp_sock = sockunion_accept (accept_sock, &su);
   if (bgp_sock < 0)
     {
-      zlog_err ("[Error] BGP socket accept failed (%s)", strerror (errno));
+      zlog_err ("[Error] BGP socket accept failed (%s)", safe_strerror (errno));
       return -1;
     }
 
@@ -318,7 +318,7 @@ bgp_socket (struct bgp *bgp, unsigned short port)
       sock = socket (ainfo->ai_family, ainfo->ai_socktype, ainfo->ai_protocol);
       if (sock < 0)
        {
-         zlog_err ("socket: %s", strerror (errno));
+         zlog_err ("socket: %s", safe_strerror (errno));
          continue;
        }
 
@@ -335,7 +335,7 @@ bgp_socket (struct bgp *bgp, unsigned short port)
 
       if (ret < 0)
        {
-         zlog_err ("bind: %s", strerror (en));
+         zlog_err ("bind: %s", safe_strerror (en));
          close(sock);
          continue;
        }
@@ -343,7 +343,7 @@ bgp_socket (struct bgp *bgp, unsigned short port)
       ret = listen (sock, 3);
       if (ret < 0) 
        {
-         zlog_err ("listen: %s", strerror (errno));
+         zlog_err ("listen: %s", safe_strerror (errno));
          close (sock);
          continue;
        }
@@ -369,7 +369,7 @@ bgp_socket (struct bgp *bgp, unsigned short port)
   sock = socket (AF_INET, SOCK_STREAM, 0);
   if (sock < 0)
     {
-      zlog_err ("socket: %s", strerror (errno));
+      zlog_err ("socket: %s", safe_strerror (errno));
       return sock;
     }
 
@@ -396,7 +396,7 @@ bgp_socket (struct bgp *bgp, unsigned short port)
 
   if (ret < 0)
     {
-      zlog_err ("bind: %s", strerror (en));
+      zlog_err ("bind: %s", safe_strerror (en));
       close (sock);
       return ret;
     }
@@ -404,7 +404,7 @@ bgp_socket (struct bgp *bgp, unsigned short port)
   ret = listen (sock, 3);
   if (ret < 0) 
     {
-      zlog_err ("listen: %s", strerror (errno));
+      zlog_err ("listen: %s", safe_strerror (errno));
       close (sock);
       return ret;
     }
index dc5d36915e42d2a51a043b7215ec69e99b92637b..8acc98e7876e9f12a2c17c55d7aca6fd885af17f 100644 (file)
@@ -152,7 +152,7 @@ bgp_connect_check (struct peer *peer)
     {
       if (BGP_DEBUG (events, EVENTS))
          plog_info (peer->log, "%s [Event] Connect failed (%s)",
-                    peer->host, strerror (errno));
+                    peer->host, safe_strerror (errno));
       BGP_EVENT_ADD (peer, TCP_connection_open_failed);
     }
 }
@@ -2115,7 +2115,7 @@ bgp_read_packet (struct peer *peer)
        return -1;
 
       plog_err (peer->log, "%s [Error] bgp_read_packet error: %s",
-                peer->host, strerror (errno));
+                peer->host, safe_strerror (errno));
       BGP_EVENT_ADD (peer, TCP_fatal_error);
       return -1;
     }  
index 4fbf16ff3b7d38a79391a1fbd902e5ba7a439c4c..a1dc582a8385d4bfb529f5e432d94a6c8c0e8de5 100644 (file)
@@ -130,7 +130,7 @@ isis_multicast_join (int fd, int registerto, int if_num)
   if (setsockopt (fd, SOL_PACKET, PACKET_ADD_MEMBERSHIP, &mreq,
                  sizeof (struct packet_mreq)))
     {
-      zlog_warn ("isis_multicast_join(): setsockopt(): %s", strerror (errno));
+      zlog_warn ("isis_multicast_join(): setsockopt(): %s", safe_strerror (errno));
       return ISIS_WARNING;
     }
 
@@ -147,7 +147,7 @@ open_packet_socket (struct isis_circuit *circuit)
   if (fd < 0)
     {
       zlog_warn ("open_packet_socket(): socket() failed %s",
-                strerror (errno));
+                safe_strerror (errno));
       return ISIS_WARNING;
     }
 
@@ -162,7 +162,7 @@ open_packet_socket (struct isis_circuit *circuit)
   if (bind (fd, (struct sockaddr *) (&s_addr),
            sizeof (struct sockaddr_ll)) < 0)
     {
-      zlog_warn ("open_packet_socket(): bind() failed: %s", strerror (errno));
+      zlog_warn ("open_packet_socket(): bind() failed: %s", safe_strerror (errno));
       return ISIS_WARNING;
     }
 
@@ -222,7 +222,7 @@ open_bpf_dev (struct isis_circuit *circuit)
   if (fd < 0)
     {
       zlog_warn ("open_bpf_dev(): failed to create bpf socket: %s",
-                strerror (errno));
+                safe_strerror (errno));
       return ISIS_WARNING;
     }
 
@@ -232,7 +232,7 @@ open_bpf_dev (struct isis_circuit *circuit)
   if (ioctl (fd, BIOCSETIF, (caddr_t) & ifr) < 0)
     {
       zlog_warn ("open_bpf_dev(): failed to bind to interface: %s",
-                strerror (errno));
+                safe_strerror (errno));
       return ISIS_WARNING;
     }
 
@@ -307,7 +307,7 @@ open_bpf_dev (struct isis_circuit *circuit)
   if (ioctl (fd, BIOCSETF, (caddr_t) & bpf_prog) < 0)
     {
       zlog_warn ("open_bpf_dev(): failed to install filter: %s",
-                strerror (errno));
+                safe_strerror (errno));
       return ISIS_WARNING;
     }
 
@@ -329,7 +329,7 @@ isis_sock_init (struct isis_circuit *circuit)
   int retval = ISIS_OK;
 
   if (isisd_privs.change (ZPRIVS_RAISE))
-    zlog_err ("%s: could not raise privs, %s", __func__, strerror (errno));
+    zlog_err ("%s: could not raise privs, %s", __func__, safe_strerror (errno));
 
 #ifdef GNU_LINUX
   retval = open_packet_socket (circuit);
@@ -362,7 +362,7 @@ isis_sock_init (struct isis_circuit *circuit)
 
 end:
   if (isisd_privs.change (ZPRIVS_LOWER))
-    zlog_err ("%s: could not lower privs, %s", __func__, strerror (errno));
+    zlog_err ("%s: could not lower privs, %s", __func__, safe_strerror (errno));
 
   return retval;
 }
@@ -395,7 +395,7 @@ isis_recv_pdu_bcast (struct isis_circuit *circuit, u_char * ssnpa)
   if (bytesread < 0)
     {
       zlog_warn ("isis_recv_packet_bcast(): fd %d, recvfrom (): %s",
-                circuit->fd, strerror (errno));
+                circuit->fd, safe_strerror (errno));
       zlog_warn ("circuit is %s", circuit->interface->name);
       zlog_warn ("circuit fd %d", circuit->fd);
       zlog_warn ("bytesread %d", bytesread);
@@ -549,7 +549,7 @@ isis_recv_pdu_bcast (struct isis_circuit *circuit, u_char * ssnpa)
 
   if (ioctl (circuit->fd, FIONREAD, (caddr_t) & bytestoread) < 0)
     {
-      zlog_warn ("ioctl() FIONREAD failed: %s", strerror (errno));
+      zlog_warn ("ioctl() FIONREAD failed: %s", safe_strerror (errno));
     }
 
   if (bytestoread)
@@ -559,7 +559,7 @@ isis_recv_pdu_bcast (struct isis_circuit *circuit, u_char * ssnpa)
   if (bytesread < 0)
     {
       zlog_warn ("isis_recv_pdu_bcast(): read() failed: %s",
-                strerror (errno));
+                safe_strerror (errno));
       return ISIS_WARNING;
     }
 
@@ -584,7 +584,7 @@ isis_recv_pdu_bcast (struct isis_circuit *circuit, u_char * ssnpa)
          ETHER_ADDR_LEN);
 
   if (ioctl (circuit->fd, BIOCFLUSH, &one) < 0)
-    zlog_warn ("Flushing failed: %s", strerror (errno));
+    zlog_warn ("Flushing failed: %s", safe_strerror (errno));
 
   return ISIS_OK;
 }
@@ -599,7 +599,7 @@ isis_recv_pdu_p2p (struct isis_circuit *circuit, u_char * ssnpa)
 
   if (bytesread < 0)
     {
-      zlog_warn ("isis_recv_pdu_p2p(): read () failed: %s", strerror (errno));
+      zlog_warn ("isis_recv_pdu_p2p(): read () failed: %s", safe_strerror (errno));
       return ISIS_WARNING;
     }
 
index af954b838d434bbd06953f1e8404eaeefcbdc24b..8364c4d70649c6fdbf1dcde6818df5e134ad67f8 100644 (file)
@@ -611,7 +611,7 @@ thread_fetch (struct thread_master *m, struct thread *fetch)
          if (errno == EINTR)
            continue;
 
-         zlog_warn ("select() error: %s", strerror (errno));
+         zlog_warn ("select() error: %s", safe_strerror (errno));
          return NULL;
        }
 
index 6de0e0dae4127c28c8996ff4c9e9571b516caa84..2a1f4665f37aebd1e13ccf86aeda5f8886bfe34d 100644 (file)
@@ -1638,7 +1638,7 @@ vty_accept (struct thread *thread)
   vty_sock = sockunion_accept (accept_sock, &su);
   if (vty_sock < 0)
     {
-      zlog_warn ("can't accept vty socket : %s", strerror (errno));
+      zlog_warn ("can't accept vty socket : %s", safe_strerror (errno));
       return -1;
     }
 
@@ -1695,7 +1695,7 @@ vty_accept (struct thread *thread)
                    (char *) &on, sizeof (on));
   if (ret < 0)
     zlog (NULL, LOG_INFO, "can't set sockopt to vty_sock : %s", 
-         strerror (errno));
+         safe_strerror (errno));
 
   vty = vty_create (vty_sock, &su);
 
@@ -1889,7 +1889,7 @@ vtysh_accept (struct thread *thread)
 
   if (sock < 0)
     {
-      zlog_warn ("can't accept vty socket : %s", strerror (errno));
+      zlog_warn ("can't accept vty socket : %s", safe_strerror (errno));
       return -1;
     }
 
index 3701e121e4a4cb9bd7c24118a6be9c634d10b44b..296fd144e7438687a4f220a5d2b5171f9b6162fe 100644 (file)
@@ -598,7 +598,7 @@ in one shot. */
     {
       if ((errno != EAGAIN) && (errno != EINTR))
         zlog_warn("buffer_flush_available write error on fd %d: %s",
-                 fd,strerror(errno));
+                 fd,safe_strerror(errno));
       return 1;
     }
 
index fc115d95ed9abf502ac15fa62151fa3e99bd3b0c..6c02c96eba3251dc083efc1f104cc53436f2f4a9 100644 (file)
@@ -2562,7 +2562,7 @@ DEFUN (config_write_file,
   if (chmod (config_file, CONFIGFILE_MASK) != 0)
     {
       vty_out (vty, "Can't chmod configuration file %s: %s (%d).%s", 
-       config_file, strerror(errno), errno, VTY_NEWLINE);
+       config_file, safe_strerror(errno), errno, VTY_NEWLINE);
       return CMD_WARNING;      
     }
 
index a5c327db12f61c002048ad69076e3cc4d327b624..6eb135f02c46a8c7360def5a595feb122b4e68d6 100644 (file)
@@ -44,7 +44,7 @@ static void
 zerror (const char *fname, int type, size_t size)
 {
   zlog_err ("%s : can't allocate memory for `%s' size %d: %s\n", 
-           fname, lookup (mstr, type), (int) size, strerror(errno));
+           fname, lookup (mstr, type), (int) size, safe_strerror(errno));
   log_memstats(LOG_WARNING);
   abort();
 }
index fca7ec83668abfefbdacb8d2b2fcffab098aa0b7..2782b9d43a4cfed407170c399c19976e39dbbfe0 100644 (file)
@@ -71,7 +71,7 @@ pid_output_lock (const char *path)
       if (fd < 0)
         {
         zlog_err( "Can't creat pid lock file %s (%s), exit", 
-                 path, strerror(errno));
+                 path, safe_strerror(errno));
       umask(oldumask);
       exit (-1);
     }
index 71e2c7fe338b131467f0a3c809e19d8883dd8da0..66681dabb16939e58e5839ebb4c654ccbcfe163b 100644 (file)
@@ -128,7 +128,7 @@ zprivs_state_caps (void)
       if ( cap_get_flag (zprivs_state.caps, zprivs_state.syscaps_p[i], 
                          CAP_EFFECTIVE, &val) )
         zlog_warn ("zprivs_state_caps: could not cap_get_flag, %s",
-                    strerror (errno) );
+                    safe_strerror (errno) );
       if (val == CAP_SET)
         return ZPRIVS_RAISED;
     }
@@ -215,7 +215,7 @@ zprivs_init(struct zebra_privs_t *zprivs)
           if ( setgroups (1, &zprivs_state.vtygrp) )
             {
               fprintf (stderr, "privs_init: could not setgroups, %s\n",
-                         strerror (errno) );
+                         safe_strerror (errno) );
               exit (1);
             }       
         }
@@ -243,7 +243,7 @@ zprivs_init(struct zebra_privs_t *zprivs)
       if ( setregid (zprivs_state.zgid, zprivs_state.zgid) )
         {
           fprintf (stderr, "zprivs_init: could not setregid, %s\n",
-                    strerror (errno) );
+                    safe_strerror (errno) );
           exit (1);
         }
     }
@@ -258,7 +258,7 @@ zprivs_init(struct zebra_privs_t *zprivs)
   if ( prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) == -1 )
     {
       fprintf (stderr, "privs_init: could not set PR_SET_KEEPCAPS, %s\n",
-                strerror (errno) );
+                safe_strerror (errno) );
       exit(1);
     }
 
@@ -270,7 +270,7 @@ zprivs_init(struct zebra_privs_t *zprivs)
   if ( !(zprivs_state.caps = cap_init()) )
     {
       fprintf (stderr, "privs_init: failed to cap_init, %s\n", 
-               strerror (errno));
+               safe_strerror (errno));
       exit (1);
     }
 
@@ -280,7 +280,7 @@ zprivs_init(struct zebra_privs_t *zprivs)
       if ( setreuid (zprivs_state.zuid, zprivs_state.zuid) )
         {
           fprintf (stderr, "zprivs_init (cap): could not setreuid, %s\n", 
-                     strerror (errno));
+                     safe_strerror (errno));
           exit (1);
         }
     }
@@ -288,7 +288,7 @@ zprivs_init(struct zebra_privs_t *zprivs)
   if ( cap_clear (zprivs_state.caps) )
     {
       fprintf (stderr, "privs_init: failed to cap_clear, %s\n", 
-               strerror (errno));
+               safe_strerror (errno));
       exit (1);
     }
   
@@ -329,7 +329,7 @@ zprivs_init(struct zebra_privs_t *zprivs)
       if ( setreuid (-1, zprivs_state.zuid) )
         {
           fprintf (stderr, "privs_init (uid): could not setreuid, %s\n", 
-                   strerror (errno));
+                   safe_strerror (errno));
           exit (1);
         }
     }
@@ -351,7 +351,7 @@ zprivs_terminate (void)
   if ( cap_set_proc (zprivs_state.caps) ) 
     {
       zlog_err ("privs_terminate: cap_set_proc failed, %s",
-                strerror (errno) );
+                safe_strerror (errno) );
       exit (1);
     }  
 
@@ -368,7 +368,7 @@ zprivs_terminate (void)
       if ( setreuid (zprivs_state.zuid, zprivs_state.zuid) )
         {
           zlog_err ("privs_terminate: could not setreuid, %s", 
-                     strerror (errno) );
+                     safe_strerror (errno) );
           exit (1);
         }
      }
index 2578609046bf34427baa6887245c31b82d63e6c9..33efccde0ab3da62f46da233d7e70d1edb4d1953 100644 (file)
@@ -904,7 +904,7 @@ smux_read (struct thread *t)
 
   if (len < 0)
     {
-      zlog_warn ("Can't read all SMUX packet: %s", strerror (errno));
+      zlog_warn ("Can't read all SMUX packet: %s", safe_strerror (errno));
       close (sock);
       smux_sock = -1;
       smux_event (SMUX_CONNECT, 0);
@@ -1181,7 +1181,7 @@ smux_connect (struct thread *t)
   ret = smux_open (smux_sock);
   if (ret < 0)
     {
-      zlog_warn ("SMUX open message send failed: %s", strerror (errno));
+      zlog_warn ("SMUX open message send failed: %s", safe_strerror (errno));
       close (smux_sock);
       smux_sock = -1;
       if (++fail < SMUX_MAX_FAILURE)
@@ -1193,7 +1193,7 @@ smux_connect (struct thread *t)
   ret = smux_register (smux_sock);
   if (ret < 0)
     {
-      zlog_warn ("SMUX register message send failed: %s", strerror (errno));
+      zlog_warn ("SMUX register message send failed: %s", safe_strerror (errno));
       close (smux_sock);
       smux_sock = -1;
       if (++fail < SMUX_MAX_FAILURE)
index 2afa3c80f15b42d2e280cc2b910132546dacd7a3..786e1528d25b1e32c5b72a98cffb16c2fa84eecf 100644 (file)
@@ -61,11 +61,11 @@ setsockopt_ipv6_pktinfo (int sock, int val)
 #ifdef IPV6_RECVPKTINFO                /*2292bis-01*/
   ret = setsockopt(sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &val, sizeof(val));
   if (ret < 0)
-    zlog_warn ("can't setsockopt IPV6_RECVPKTINFO : %s", strerror (errno));
+    zlog_warn ("can't setsockopt IPV6_RECVPKTINFO : %s", safe_strerror (errno));
 #else  /*RFC2292*/
   ret = setsockopt(sock, IPPROTO_IPV6, IPV6_PKTINFO, &val, sizeof(val));
   if (ret < 0)
-    zlog_warn ("can't setsockopt IPV6_PKTINFO : %s", strerror (errno));
+    zlog_warn ("can't setsockopt IPV6_PKTINFO : %s", safe_strerror (errno));
 #endif /* INIA_IPV6 */
   return ret;
 }
index 78e02f26e80c5500a9003b74bcc9757c9baba3aa..7157b49c42f4dc03e528c09b7b53c67843a4f731 100644 (file)
@@ -236,7 +236,7 @@ sockunion_socket (union sockunion *su)
   sock = socket (su->sa.sa_family, SOCK_STREAM, 0);
   if (sock < 0)
     {
-      zlog (NULL, LOG_WARNING, "Can't make socket : %s", strerror (errno));
+      zlog (NULL, LOG_WARNING, "Can't make socket : %s", safe_strerror (errno));
       return -1;
     }
 
@@ -377,7 +377,7 @@ sockunion_connect (int fd, union sockunion *peersu, unsigned short port,
       if (errno != EINPROGRESS)
        {
          zlog_info ("can't connect to %s fd %d : %s",
-                    sockunion_log (&su), fd, strerror (errno));
+                    sockunion_log (&su), fd, safe_strerror (errno));
          return connect_error;
        }
     }
@@ -444,7 +444,7 @@ sockunion_bind (int sock, union sockunion *su, unsigned short port,
 
   ret = bind (sock, (struct sockaddr *)su, size);
   if (ret < 0)
-    zlog (NULL, LOG_WARNING, "can't bind socket : %s", strerror (errno));
+    zlog (NULL, LOG_WARNING, "can't bind socket : %s", safe_strerror (errno));
 
   return ret;
 }
@@ -576,7 +576,7 @@ sockunion_getsockname (int fd)
   if (ret < 0)
     {
       zlog_warn ("Can't get local address and port by getsockname: %s",
-                strerror (errno));
+                safe_strerror (errno));
       return NULL;
     }
 
@@ -630,7 +630,7 @@ sockunion_getpeername (int fd)
   if (ret < 0)
     {
       zlog (NULL, LOG_WARNING, "Can't get remote address and port: %s",
-           strerror (errno));
+           safe_strerror (errno));
       return NULL;
     }
 
index 09d6ff733292f60d68295eb5570a6f85a6f017be..89df06a09b3c1b783e318a5ff91bd8ea948b16fb 100644 (file)
@@ -791,7 +791,7 @@ thread_fetch (struct thread_master *m, struct thread *fetch)
               continue;
             }
 
-          zlog_warn ("select() error: %s", strerror (errno));
+          zlog_warn ("select() error: %s", safe_strerror (errno));
             return NULL;
         }
 
index 3e10a9473451eaa1b4d7b00dc3c3fbfbe1aab6e0..016e52a98a067a7b5af5166785c031481ad43583 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -1598,7 +1598,7 @@ vty_accept (struct thread *thread)
   vty_sock = sockunion_accept (accept_sock, &su);
   if (vty_sock < 0)
     {
-      zlog_warn ("can't accept vty socket : %s", strerror (errno));
+      zlog_warn ("can't accept vty socket : %s", safe_strerror (errno));
       return -1;
     }
 
@@ -1655,7 +1655,7 @@ vty_accept (struct thread *thread)
                    (char *) &on, sizeof (on));
   if (ret < 0)
     zlog (NULL, LOG_INFO, "can't set sockopt to vty_sock : %s", 
-         strerror (errno));
+         safe_strerror (errno));
 
   vty = vty_create (vty_sock, &su);
 
@@ -1758,7 +1758,7 @@ vty_serv_sock_family (const char* addr, unsigned short port, int family)
        naddr=NULL;
        break;
       case 0:
-        zlog_err("error translating address %s: %s",addr,strerror(errno));
+        zlog_err("error translating address %s: %s",addr,safe_strerror(errno));
        naddr=NULL;
     }
 
@@ -1857,7 +1857,7 @@ vty_serv_un (const char *path)
       if ( chown (path, -1, ids.gid_vty) )
         {
           zlog_err ("vty_serv_un: could chown socket, %s",
-                     strerror (errno) );
+                     safe_strerror (errno) );
         }
     }
 
@@ -1888,7 +1888,7 @@ vtysh_accept (struct thread *thread)
 
   if (sock < 0)
     {
-      zlog_warn ("can't accept vty socket : %s", strerror (errno));
+      zlog_warn ("can't accept vty socket : %s", safe_strerror (errno));
       return -1;
     }
 
@@ -1897,7 +1897,7 @@ vtysh_accept (struct thread *thread)
       || (fcntl (sock, F_SETFL, flags|O_NONBLOCK) == -1) )
     {
       zlog_warn ("vtysh_accept: could not set vty socket to non-blocking,"
-                 " %s, closing", strerror (errno));
+                 " %s, closing", safe_strerror (errno));
       close (sock);
       return -1;
     }
index d6356c7279afd618a831b2a448dbf9860fb538a8..48f79afa075ee82c00d383edf23e41e292702bb0 100644 (file)
@@ -179,7 +179,7 @@ ospf6_lsa_age_set (struct ospf6_lsa *lsa)
 
   if (gettimeofday (&now, (struct timezone *)NULL) < 0)
     zlog_warn ("LSA: gettimeofday failed, may fail LSA AGEs: %s",
-               strerror (errno));
+               safe_strerror (errno));
 
   lsa->birth.tv_sec = now.tv_sec - ntohs (lsa->header->age);
   lsa->birth.tv_usec = now.tv_usec;
@@ -202,7 +202,7 @@ ospf6_lsa_age_current (struct ospf6_lsa *lsa)
   /* current time */
   if (gettimeofday (&now, (struct timezone *)NULL) < 0)
     zlog_warn ("LSA: gettimeofday failed, may fail LSA AGEs: %s",
-               strerror (errno));
+               safe_strerror (errno));
 
   /* calculate age */
   ulage = now.tv_sec - lsa->birth.tv_sec;
index de0c3f3819bc251e56b6b65f57177fac4868e55a..382310f84ab97c20f775cfb2d8e0f949d908664f 100644 (file)
@@ -43,7 +43,7 @@ ospf6_set_reuseaddr ()
   u_int on = 0;
   if (setsockopt (ospf6_sock, SOL_SOCKET, SO_REUSEADDR, &on,
                   sizeof (u_int)) < 0)
-    zlog_warn ("Network: set SO_REUSEADDR failed: %s", strerror (errno));
+    zlog_warn ("Network: set SO_REUSEADDR failed: %s", safe_strerror (errno));
 }
 
 /* setsockopt MulticastLoop to off */
@@ -54,7 +54,7 @@ ospf6_reset_mcastloop ()
   if (setsockopt (ospf6_sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
                   &off, sizeof (u_int)) < 0)
     zlog_warn ("Network: reset IPV6_MULTICAST_LOOP failed: %s",
-               strerror (errno));
+               safe_strerror (errno));
 }
 
 void
@@ -70,7 +70,7 @@ ospf6_set_checksum ()
 #ifndef DISABLE_IPV6_CHECKSUM
   if (setsockopt (ospf6_sock, IPPROTO_IPV6, IPV6_CHECKSUM,
                   &offset, sizeof (offset)) < 0)
-    zlog_warn ("Network: set IPV6_CHECKSUM failed: %s", strerror (errno));
+    zlog_warn ("Network: set IPV6_CHECKSUM failed: %s", safe_strerror (errno));
 #else
   zlog_warn ("Network: Don't set IPV6_CHECKSUM");
 #endif /* DISABLE_IPV6_CHECKSUM */
@@ -127,7 +127,7 @@ ospf6_join_allspfrouters (u_int ifindex)
 
   if (retval < 0)
     zlog_err ("Network: Join AllSPFRouters on ifindex %d failed: %s",
-              ifindex, strerror (errno));
+              ifindex, safe_strerror (errno));
 #if 0
   else
     zlog_info ("Network: Join AllSPFRouters on ifindex %d", ifindex);
@@ -147,7 +147,7 @@ ospf6_leave_allspfrouters (u_int ifindex)
   if (setsockopt (ospf6_sock, IPPROTO_IPV6, IPV6_LEAVE_GROUP,
                   &mreq6, sizeof (mreq6)) < 0)
     zlog_warn ("Network: Leave AllSPFRouters on ifindex %d Failed: %s",
-               ifindex, strerror (errno));
+               ifindex, safe_strerror (errno));
 #if 0
   else
     zlog_info ("Network: Leave AllSPFRouters on ifindex %d", ifindex);
@@ -167,7 +167,7 @@ ospf6_join_alldrouters (u_int ifindex)
   if (setsockopt (ospf6_sock, IPPROTO_IPV6, IPV6_JOIN_GROUP,
                   &mreq6, sizeof (mreq6)) < 0)
     zlog_warn ("Network: Join AllDRouters on ifindex %d Failed: %s",
-               ifindex, strerror (errno));
+               ifindex, safe_strerror (errno));
 #if 0
   else
     zlog_info ("Network: Join AllDRouters on ifindex %d", ifindex);
@@ -264,7 +264,7 @@ ospf6_sendmsg (struct in6_addr *src, struct in6_addr *dst,
   retval = sendmsg (ospf6_sock, &smsghdr, 0);
   if (retval != iov_totallen (message))
     zlog_warn ("sendmsg failed: ifindex: %d: %s (%d)",
-               *ifindex, strerror (errno), errno);
+               *ifindex, safe_strerror (errno), errno);
 
   return retval;
 }
@@ -300,7 +300,7 @@ ospf6_recvmsg (struct in6_addr *src, struct in6_addr *dst,
 
   retval = recvmsg (ospf6_sock, &rmsghdr, 0);
   if (retval < 0)
-    zlog_warn ("recvmsg failed: %s", strerror (errno));
+    zlog_warn ("recvmsg failed: %s", safe_strerror (errno));
   else if (retval == iov_totallen (message))
     zlog_warn ("recvmsg read full buffer size: %d", retval);
 
index 0baaaea9d670ac51ad55105b547be2b6b6de2330..2b21567f524cd290c426268aced029d592128ec7 100644 (file)
@@ -461,7 +461,7 @@ ospf6_zebra_route_update (int type, struct ospf6_route *request)
 
   if (ret < 0)
     zlog_err ("zapi_ipv6_route() %s failed: %s",
-              (type == REM ? "delete" : "add"), strerror (errno));
+              (type == REM ? "delete" : "add"), safe_strerror (errno));
 
   XFREE (MTYPE_OSPF6_OTHER, nexthops);
   XFREE (MTYPE_OSPF6_OTHER, ifindexes);
index 96ccb8b44c379f6a398261ae057a21ea1ed756b1..d6aa6387586003e53b223e501c4b8e3872c3eede 100644 (file)
@@ -156,7 +156,7 @@ ospf_apiclient_connect (char *host, int syncport)
   ret = listen (async_server_sock, BACKLOG);
   if (ret < 0)
     {
-      fprintf (stderr, "ospf_apiclient_connect: listen: %s\n", strerror (errno));
+      fprintf (stderr, "ospf_apiclient_connect: listen: %s\n", safe_strerror (errno));
       close (async_server_sock);
       return NULL;
     }
index cd69336ca8f07c82e81d765dffa9f8a578e48dc3..8821d7412da917c51cb5bc89e66cf92146f9b899 100644 (file)
@@ -359,7 +359,7 @@ msg_read (int fd)
 
   if (rlen < 0)
     {
-      zlog_warn ("msg_read: readn %s", strerror (errno));
+      zlog_warn ("msg_read: readn %s", safe_strerror (errno));
       return NULL;
     }
   else if (rlen == 0)
@@ -389,7 +389,7 @@ msg_read (int fd)
       rlen = readn (fd, buf, bodylen);
       if (rlen < 0)
        {
-         zlog_warn ("msg_read: readn %s", strerror (errno));
+         zlog_warn ("msg_read: readn %s", safe_strerror (errno));
          return NULL;
        }
       else if (rlen == 0)
@@ -431,7 +431,7 @@ msg_write (int fd, struct msg *msg)
   wlen = writen (fd, buf, l);
   if (wlen < 0)
     {
-      zlog_warn ("msg_write: writen %s", strerror (errno));
+      zlog_warn ("msg_write: writen %s", safe_strerror (errno));
       return -1;
     }
   else if (wlen == 0)
index 8bc16dc325d11ff4d63aadbd18e3002ae09c5184..671bbc501441330f9b176c157e06520ad9138e87 100644 (file)
@@ -646,7 +646,7 @@ ospf_apiserver_serv_sock_family (unsigned short port, int family)
   if (rc < 0)
     {
       zlog_warn ("ospf_apiserver_serv_sock_family: listen: %s",
-                 strerror (errno));
+                 safe_strerror (errno));
       close (accept_sock);     /* Close socket */
       return rc;
     }
@@ -680,7 +680,7 @@ ospf_apiserver_accept (struct thread *thread)
   new_sync_sock = sockunion_accept (accept_sock, &su);
   if (new_sync_sock < 0)
     {
-      zlog_warn ("ospf_apiserver_accept: accept: %s", strerror (errno));
+      zlog_warn ("ospf_apiserver_accept: accept: %s", safe_strerror (errno));
       return -1;
     }
 
@@ -693,7 +693,7 @@ ospf_apiserver_accept (struct thread *thread)
   ret = getpeername (new_sync_sock, (struct sockaddr *)&peer_sync, &peerlen);
   if (ret < 0)
     {
-      zlog_warn ("ospf_apiserver_accept: getpeername: %s", strerror (errno));
+      zlog_warn ("ospf_apiserver_accept: getpeername: %s", safe_strerror (errno));
       close (new_sync_sock);
       return -1;
     }
@@ -718,7 +718,7 @@ ospf_apiserver_accept (struct thread *thread)
   new_async_sock = socket (AF_INET, SOCK_STREAM, 0);
   if (new_async_sock < 0)
     {
-      zlog_warn ("ospf_apiserver_accept: socket: %s", strerror (errno));
+      zlog_warn ("ospf_apiserver_accept: socket: %s", safe_strerror (errno));
       close (new_sync_sock);
       return -1;
     }
@@ -728,7 +728,7 @@ ospf_apiserver_accept (struct thread *thread)
 
   if (ret < 0)
     {
-      zlog_warn ("ospf_apiserver_accept: connect: %s", strerror (errno));
+      zlog_warn ("ospf_apiserver_accept: connect: %s", safe_strerror (errno));
       close (new_sync_sock);
       close (new_async_sock);
       return -1;
@@ -740,7 +740,7 @@ ospf_apiserver_accept (struct thread *thread)
   ret = shutdown (new_async_sock, SHUT_RD);
   if (ret < 0)
     {
-      zlog_warn ("ospf_apiserver_accept: shutdown: %s", strerror (errno));
+      zlog_warn ("ospf_apiserver_accept: shutdown: %s", safe_strerror (errno));
       close (new_sync_sock);
       close (new_async_sock);
       return -1;
index 266f775a81bfa8a2e5e3c4604867918bcd0d7bcd..7d5b7301d7f3f4b69906c56ee913557c370cd69f 100644 (file)
@@ -56,7 +56,7 @@ ospf_if_add_allspfrouters (struct ospf *top, struct prefix *p,
                                    ifindex);
   if (ret < 0)
     zlog_warn ("can't setsockopt IP_ADD_MEMBERSHIP (AllSPFRouters): %s",
-               strerror (errno));
+               safe_strerror (errno));
   else
     zlog_info ("interface %s join AllSPFRouters Multicast group.",
               inet_ntoa (p->u.prefix4));
@@ -75,7 +75,7 @@ ospf_if_drop_allspfrouters (struct ospf *top, struct prefix *p,
                                    ifindex);
   if (ret < 0)
     zlog_warn("can't setsockopt IP_DROP_MEMBERSHIP (AllSPFRouters): %s",
-             strerror (errno));
+             safe_strerror (errno));
   else
     zlog_info ("interface %s leave AllSPFRouters Multicast group.",
               inet_ntoa (p->u.prefix4));
@@ -95,7 +95,7 @@ ospf_if_add_alldrouters (struct ospf *top, struct prefix *p, unsigned int
                                    ifindex);
   if (ret < 0)
     zlog_warn ("can't setsockopt IP_ADD_MEMBERSHIP (AllDRouters): %s",
-               strerror (errno));
+               safe_strerror (errno));
   else
     zlog_info ("interface %s join AllDRouters Multicast group.",
               inet_ntoa (p->u.prefix4));
@@ -114,7 +114,7 @@ ospf_if_drop_alldrouters (struct ospf *top, struct prefix *p, unsigned int
                                    ifindex);
   if (ret < 0)
     zlog_warn ("can't setsockopt IP_DROP_MEMBERSHIP (AllDRouters): %s",
-              strerror (errno));
+              safe_strerror (errno));
   else
     zlog_info ("interface %s leave AllDRouters Multicast group.",
               inet_ntoa (p->u.prefix4));
@@ -134,18 +134,18 @@ ospf_if_ipmulticast (struct ospf *top, struct prefix *p, unsigned int ifindex)
   /* Prevent receiving self-origined multicast packets. */
   ret = setsockopt (top->fd, IPPROTO_IP, IP_MULTICAST_LOOP, (void *)&val, len);
   if (ret < 0)
-    zlog_warn ("can't setsockopt IP_MULTICAST_LOOP(0): %s", strerror (errno));
+    zlog_warn ("can't setsockopt IP_MULTICAST_LOOP(0): %s", safe_strerror (errno));
   
   /* Explicitly set multicast ttl to 1 -- endo. */
   val = 1;
   ret = setsockopt (top->fd, IPPROTO_IP, IP_MULTICAST_TTL, (void *)&val, len);
   if (ret < 0)
-    zlog_warn ("can't setsockopt IP_MULTICAST_TTL(1): %s", strerror (errno));
+    zlog_warn ("can't setsockopt IP_MULTICAST_TTL(1): %s", safe_strerror (errno));
 
   ret = setsockopt_multicast_ipv4 (top->fd, IP_MULTICAST_IF,
                                    p->u.prefix4, 0, ifindex);
   if (ret < 0)
-    zlog_warn ("can't setsockopt IP_MULTICAST_IF: %s", strerror (errno));
+    zlog_warn ("can't setsockopt IP_MULTICAST_IF: %s", safe_strerror (errno));
 
   return ret;
 }
@@ -158,15 +158,15 @@ ospf_sock_init (void)
 
   if ( ospfd_privs.change (ZPRIVS_RAISE) )
     zlog_err ("ospf_sock_init: could not raise privs, %s",
-               strerror (errno) );
+               safe_strerror (errno) );
     
   ospf_sock = socket (AF_INET, SOCK_RAW, IPPROTO_OSPFIGP);
   if (ospf_sock < 0)
     {
       if ( ospfd_privs.change (ZPRIVS_LOWER) )
         zlog_err ("ospf_sock_init: could not lower privs, %s",
-                   strerror (errno) );
-      zlog_err ("ospf_read_sock_init: socket: %s", strerror (errno));
+                   safe_strerror (errno) );
+      zlog_err ("ospf_read_sock_init: socket: %s", safe_strerror (errno));
       exit(-1);
     }
     
@@ -177,7 +177,7 @@ ospf_sock_init (void)
     {
       if ( ospfd_privs.change (ZPRIVS_LOWER) )
         zlog_err ("ospf_sock_init: could not lower privs, %s",
-                   strerror (errno) );
+                   safe_strerror (errno) );
       zlog_warn ("Can't set IP_HDRINCL option");
     }
 #elif defined (IPTOS_PREC_INTERNETCONTROL)
@@ -191,7 +191,7 @@ ospf_sock_init (void)
     {
       if ( ospfd_privs.change (ZPRIVS_LOWER) )
         zlog_err ("ospf_sock_init: could not lower privs, %s",
-                   strerror (errno) );
+                   safe_strerror (errno) );
       zlog_warn ("can't set sockopt IP_TOS %d to socket %d", tos, ospf_sock);
       close (ospf_sock);       /* Prevent sd leak. */
       return ret;
@@ -209,7 +209,7 @@ ospf_sock_init (void)
   if (ospfd_privs.change (ZPRIVS_LOWER))
     {
       zlog_err ("ospf_sock_init: could not lower privs, %s",
-               strerror (errno) );
+               safe_strerror (errno) );
     }
  
   return ospf_sock;
index 8563b85a798c9443df95630a9d456fe838abccb3..74bb5b7b72f05d77c86c783e2b98da966f43a947 100644 (file)
@@ -387,7 +387,7 @@ ospf_register_opaque_functab (
                      sizeof (struct ospf_opaque_functab))) == NULL)
     {
       zlog_warn ("ospf_register_opaque_functab: XMALLOC: %s",
-                 strerror (errno));
+                 safe_strerror (errno));
       goto out;
     }
 
@@ -536,7 +536,7 @@ register_opaque_info_per_type (struct ospf_opaque_functab *functab,
   if ((oipt = XCALLOC (MTYPE_OPAQUE_INFO_PER_TYPE,
                       sizeof (struct opaque_info_per_type))) == NULL)
     {
-      zlog_warn ("register_opaque_info_per_type: XMALLOC: %s", strerror (errno));
+      zlog_warn ("register_opaque_info_per_type: XMALLOC: %s", safe_strerror (errno));
       goto out;
     }
 
@@ -689,7 +689,7 @@ register_opaque_info_per_id (struct opaque_info_per_type *oipt,
   if ((oipi = XCALLOC (MTYPE_OPAQUE_INFO_PER_ID,
                       sizeof (struct opaque_info_per_id))) == NULL)
     {
-      zlog_warn ("register_opaque_info_per_id: XMALLOC: %s", strerror (errno));
+      zlog_warn ("register_opaque_info_per_id: XMALLOC: %s", safe_strerror (errno));
       goto out;
     }
   oipi->opaque_id = GET_OPAQUE_ID (ntohl (new->data->id.s_addr));
index c582533b864d1489beeced2bb19f82eee0dfad13..729c8f7ea88dd09777e022ffa1fca02563abc526 100644 (file)
@@ -539,7 +539,7 @@ ospf_write_frags (int fd, struct ospf_packet *op, struct ip *iph,
                    iph->ip_id,
                    iph->ip_off,
                    iph->ip_len,
-                   strerror (errno));
+                   safe_strerror (errno));
       
       if (IS_DEBUG_OSPF_PACKET (type - 1, SEND))
         {
@@ -690,7 +690,7 @@ ospf_write (struct thread *thread)
   
   if (ret < 0)
     zlog_warn ("*** sendmsg in ospf_write to %s failed with %s",
-      inet_ntoa (iph.ip_dst), strerror (errno));
+      inet_ntoa (iph.ip_dst), safe_strerror (errno));
 
   /* Show debug sending packet. */
   if (IS_DEBUG_OSPF_PACKET (type - 1, SEND))
index 4a28ae834502627d873535f05b711a1263e5eb35..ff89350eae1375ae7109ffbf9325b14c9a16e2ad 100644 (file)
@@ -563,7 +563,7 @@ ospf_mpls_te_new_if (struct interface *ifp)
   if ((new = XMALLOC (MTYPE_OSPF_MPLS_TE_LINKPARAMS,
                   sizeof (struct mpls_te_link))) == NULL)
     {
-      zlog_warn ("ospf_mpls_te_new_if: XMALLOC: %s", strerror (errno));
+      zlog_warn ("ospf_mpls_te_new_if: XMALLOC: %s", safe_strerror (errno));
       goto out;
     }
   memset (new, 0, sizeof (struct mpls_te_link));
@@ -1647,7 +1647,7 @@ DEFUN (mpls_te_link_maxbw,
   ntohf (&lp->max_bw.value, &f1);
   if (sscanf (argv[0], "%g", &f2) != 1)
     {
-      vty_out (vty, "mpls_te_link_maxbw: fscanf: %s%s", strerror (errno), VTY_NEWLINE);
+      vty_out (vty, "mpls_te_link_maxbw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE);
       return CMD_WARNING;
     }
 
@@ -1689,7 +1689,7 @@ DEFUN (mpls_te_link_max_rsv_bw,
   ntohf (&lp->max_rsv_bw.value, &f1);
   if (sscanf (argv[0], "%g", &f2) != 1)
     {
-      vty_out (vty, "mpls_te_link_max_rsv_bw: fscanf: %s%s", strerror (errno), VTY_NEWLINE);
+      vty_out (vty, "mpls_te_link_max_rsv_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE);
       return CMD_WARNING;
     }
 
@@ -1733,14 +1733,14 @@ DEFUN (mpls_te_link_unrsv_bw,
   /* We don't have to consider about range check here. */
   if (sscanf (argv[0], "%d", &priority) != 1)
     {
-      vty_out (vty, "mpls_te_link_unrsv_bw: fscanf: %s%s", strerror (errno), VTY_NEWLINE);
+      vty_out (vty, "mpls_te_link_unrsv_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE);
       return CMD_WARNING;
     }
 
   ntohf (&lp->unrsv_bw.value [priority], &f1);
   if (sscanf (argv[1], "%g", &f2) != 1)
     {
-      vty_out (vty, "mpls_te_link_unrsv_bw: fscanf: %s%s", strerror (errno), VTY_NEWLINE);
+      vty_out (vty, "mpls_te_link_unrsv_bw: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE);
       return CMD_WARNING;
     }
 
@@ -1781,7 +1781,7 @@ DEFUN (mpls_te_link_rsc_clsclr,
 
   if (sscanf (argv[0], "0x%lx", &value) != 1)
     {
-      vty_out (vty, "mpls_te_link_rsc_clsclr: fscanf: %s%s", strerror (errno), VTY_NEWLINE);
+      vty_out (vty, "mpls_te_link_rsc_clsclr: fscanf: %s%s", safe_strerror (errno), VTY_NEWLINE);
       return CMD_WARNING;
     }
 
index c1c0a45a9403c7af3eab3687884a1b4a1d54d9be..55848faa165c6e7f1f7d9981a90dd8736693a090 100644 (file)
@@ -86,7 +86,7 @@ ipv4_multicast_join (int sock,
 
   if (ret < 0) 
     zlog (NULL, LOG_INFO, "can't setsockopt IP_ADD_MEMBERSHIP %s",
-         strerror (errno));
+         safe_strerror (errno));
 
   return ret;
 }
@@ -193,7 +193,7 @@ rip_interface_multicast_set (int sock, struct connected *connected)
                 sock,inet_ntoa(from.sin_addr),
                 (int)ntohs(from.sin_port),
                 connected->ifp->name,
-                 strerror (errno));
+                 safe_strerror (errno));
     }
 
   if (ripd_privs.change (ZPRIVS_LOWER))
index 0f854cf3cb71af492dc2c512ce66d05f2806a0e0..e239fd4e68ab7f01af3872e655cc91821668af59 100644 (file)
@@ -1350,7 +1350,7 @@ rip_send_packet (u_char * buf, int size, struct sockaddr_in *to,
       if (send_sock < 0)
         {
           zlog_warn("rip_send_packet could not create socket %s",
-                    strerror(errno));
+                    safe_strerror(errno));
           return -1;
     }
       sockopt_broadcast (send_sock);
@@ -1370,7 +1370,7 @@ rip_send_packet (u_char * buf, int size, struct sockaddr_in *to,
                   ntohs (sin.sin_port));
 
   if (ret < 0)
-    zlog_warn ("can't send packet : %s", strerror (errno));
+    zlog_warn ("can't send packet : %s", safe_strerror (errno));
 
   if (!to)
     close(send_sock);
@@ -1604,7 +1604,7 @@ setsockopt_pktinfo (int sock)
     
   ret = setsockopt(sock, IPPROTO_IP, IP_PKTINFO, &val, sizeof(val));
   if (ret < 0)
-    zlog_warn ("Can't setsockopt IP_PKTINFO : %s", strerror (errno));
+    zlog_warn ("Can't setsockopt IP_PKTINFO : %s", safe_strerror (errno));
   return ret;
 }
 
@@ -1662,7 +1662,7 @@ rip_read_new (struct thread *t)
   ret = rip_recvmsg (sock, buf, RIP_PACKET_MAXSIZ, &from, (int *)&ifindex);
   if (ret < 0)
     {
-      zlog_warn ("Can't read RIP packet: %s", strerror (errno));
+      zlog_warn ("Can't read RIP packet: %s", safe_strerror (errno));
       return ret;
     }
 
@@ -1701,7 +1701,7 @@ rip_read (struct thread *t)
                  (struct sockaddr *) &from, &fromlen);
   if (len < 0) 
     {
-      zlog_info ("recvfrom failed: %s", strerror (errno));
+      zlog_info ("recvfrom failed: %s", safe_strerror (errno));
       return len;
     }
 
index f5467f978fbfecfe357fac5321e0d5f657a2f70c..a7c9cefbde64e7b625549d25acb1cb000dcd0c3f 100644 (file)
@@ -94,7 +94,7 @@ ripng_multicast_join (struct interface *ifp)
       }
 
     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));
 
     if (IS_RIPNG_DEBUG_EVENT)
       zlog_info ("RIPng %s join to all-rip-routers multicast group", ifp->name);
@@ -120,7 +120,7 @@ ripng_multicast_leave (struct interface *ifp)
     ret = setsockopt (ripng->sock, IPPROTO_IPV6, IPV6_LEAVE_GROUP,
                      (char *) &mreq, sizeof (mreq));
     if (ret < 0)
-      zlog_warn ("can't setsockopt IPV6_LEAVE_GROUP: %s\n", strerror (errno));
+      zlog_warn ("can't setsockopt IPV6_LEAVE_GROUP: %s\n", safe_strerror (errno));
 
     if (IS_RIPNG_DEBUG_EVENT)
       zlog_info ("RIPng %s leave from all-rip-routers multicast group",
index edf959fa1440b6f2036966460b8adf28268f085d..5d5c25d06fbfc3172a82e69deb275db61766ea2b 100644 (file)
@@ -151,7 +151,7 @@ ripng_make_socket (void)
   ret = bind (sock, (struct sockaddr *) &ripaddr, sizeof (ripaddr));
   if (ret < 0)
   {
-    zlog (NULL, LOG_ERR, "Can't bind ripng socket: %s.", strerror (errno));
+    zlog (NULL, LOG_ERR, "Can't bind ripng socket: %s.", safe_strerror (errno));
     if (ripngd_privs.change (ZPRIVS_LOWER))
       zlog_err ("ripng_make_socket: could not lower privs");
     return ret;
@@ -224,9 +224,9 @@ ripng_send_packet (caddr_t buf, int bufsize, struct sockaddr_in6 *to,
   if (ret < 0) {
     if (to)
       zlog_err ("RIPng send fail on %s to %s: %s", ifp->name, 
-                inet6_ntop (&to->sin6_addr), strerror (errno));
+                inet6_ntop (&to->sin6_addr), safe_strerror (errno));
     else
-      zlog_err ("RIPng send fail on %s: %s", ifp->name, strerror (errno));
+      zlog_err ("RIPng send fail on %s: %s", ifp->name, safe_strerror (errno));
   }
 
   return ret;
@@ -1360,7 +1360,7 @@ ripng_read (struct thread *thread)
                           &hoplimit);
   if (len < 0) 
     {
-      zlog_warn ("RIPng recvfrom failed: %s.", strerror (errno));
+      zlog_warn ("RIPng recvfrom failed: %s.", safe_strerror (errno));
       return len;
     }
 
index c7271ff02d75cabf1167ac7b3642f63687acb9a5..08bd1275cc95fda3385d00523081077ecbf71442 100644 (file)
@@ -33,6 +33,7 @@
 #include "command.h"
 #include "memory.h"
 #include "vtysh/vtysh.h"
+#include "log.h"
 
 /* Struct VTY. */
 struct vty *vty;
@@ -1562,7 +1563,7 @@ int write_config_integrated(void)
   if (chmod (integrate_default, CONFIGFILE_MASK) != 0)
     {
       fprintf (stdout,"%% Can't chmod configuration file %s: %s (%d)\n", 
-       integrate_default, strerror(errno), errno);
+       integrate_default, safe_strerror(errno), errno);
       return CMD_WARNING;
     }
 
@@ -1715,7 +1716,7 @@ execute_command (const char *command, int argc, const char *arg1,
   if (pid < 0)
     {
       /* Failure of fork(). */
-      fprintf (stderr, "Can't fork: %s\n", strerror (errno));
+      fprintf (stderr, "Can't fork: %s\n", safe_strerror (errno));
       exit (1);
     }
   else if (pid == 0)
@@ -1735,7 +1736,7 @@ execute_command (const char *command, int argc, const char *arg1,
        }
 
       /* When execlp suceed, this part is not executed. */
-      fprintf (stderr, "Can't execute %s: %s\n", command, strerror (errno));
+      fprintf (stderr, "Can't execute %s: %s\n", command, safe_strerror (errno));
       exit (1);
     }
   else
@@ -1893,7 +1894,7 @@ vtysh_connect (struct vtysh_client *vclient, const char *path)
   if (ret < 0 && errno != ENOENT)
     {
       fprintf  (stderr, "vtysh_connect(%s): stat = %s\n", 
-               path, strerror(errno)); 
+               path, safe_strerror(errno)); 
       exit(1);
     }
   
@@ -1913,7 +1914,7 @@ vtysh_connect (struct vtysh_client *vclient, const char *path)
     {
 #ifdef DEBUG
       fprintf(stderr, "vtysh_connect(%s): socket = %s\n", path,
-             strerror(errno));
+             safe_strerror(errno));
 #endif /* DEBUG */
       return -1;
     }
@@ -1932,7 +1933,7 @@ vtysh_connect (struct vtysh_client *vclient, const char *path)
     {
 #ifdef DEBUG
       fprintf(stderr, "vtysh_connect(%s): connect = %s\n", path,
-             strerror(errno));
+             safe_strerror(errno));
 #endif /* DEBUG */
       close (sock);
       return -1;
index 431e7ea18a28f05211e08a71c5af73c9a14ca426..90f18e28e0f7a074daec5e0cc3494140a9110e94 100644 (file)
@@ -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;
index 4f8284a31cec07d70dbec629e7d554c6e10e3328..1cbf555eb5c54a459930bae60221c742efd3d0d8 100644 (file)
@@ -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
             {
index 6c47d4307616f8e21f72d65e6b4fe477653a4d18..199a8e70d2c5094d5c10aee8126f608df1ec4e09 100644 (file)
@@ -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;
     }
   
index 1441dfcc059e2946b0764209ee33c490a7a098e7..7ad570f4a401295b04b64cd61bbdc41e63de322f 100644 (file)
@@ -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;
     }
 
index 813adb842c7836f0b91a6ade6c3531d2526b8901..f97dc3fdc87416dc368913b4ae8cb22224190913 100644 (file)
@@ -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;
     }
 
index 7b4dde36400865a4b90d0df20b966db5d12f648e..8ebd0f41d00faff29d3d2af94d1b10f3a1e8fced 100644 (file)
@@ -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;
     
index 4c30cf678b0ef26e71013be047efe79363c3df3a..443cb1c6e2921fb2c7c107c39607feffcba6ce8e 100644 (file)
@@ -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 ();
 }
index 8d6fd98b8c6b626c55e7378f9f0b007ab5e0c13e..2eaf34168bf5f2b6b7e06533c646481a5afde369 100644 (file)
@@ -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;
         }
     } 
index e824abed75e3a4e7e619f3af5a636d28dbe8d39f..d6fd1c597f61f663dced3855fd962f368cf51706 100644 (file)
@@ -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;
 }
index 7b9169698ac2f78e14daca84e745295c3e3aa20a..8f0250bf7de224833dc07a2c7ad5e33341ae0e77 100644 (file)
@@ -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;
   };
 
index 60604353ca60930deb6229a1c53f7677a18bbeb7..d78348cdf7543ff6713384d8ef8f0f825a9e51ad 100644 (file)
@@ -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); */
 }
index 27b889578832ed727aa378f843980daad302df51..60542c61d35cd2d02e51467850a44f14a45102ea 100644 (file)
@@ -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;
     }
 
index d470572b357911b40cd89f0e1a8430531c8f2006..3484010480c78ec1d019b8c6a0acf227f0a85b63 100644 (file)
@@ -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;
index 50e83b77c110cfed9c04e674aedc02d68ffe61d5..eb31e6cdea0a182b180b97eb98242318de0a9a05 100644 (file)
@@ -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;
     }
 
index cb29a67efca942612d60d55b29311e420a718528..770f975b79d1a8c1306384a722196761fa0a4390 100644 (file)
@@ -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);
 
index 435eed80fc5bc56cd7f8bc0c7ffc2837b77dc14e..ff6d7bc029d36cf5971ce99d3c9a37d42c9f0a34 100644 (file)
@@ -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;
                        }
 
index 320152e7c47d58ac37964e0b53b3abe0e19616d2..6e021c32a6ef1bbf5a82e1c637687cb15a350e08 100644 (file)
@@ -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;
     }
   
index 970c0aa1db87cb73d3b948aae83e3ea0b93f751c..78864f2b4c2f63dcda26f4beeb9b38e8641ad1e4 100644 (file)
@@ -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;
     }
 
index 10dd5fa56a18cfe1922d54612650bdec23f8c4e7..09dddf63b70b58674231cb42e6df05c94520aa06 100644 (file)
@@ -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;