summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorajs <ajs>2004-11-20 02:06:59 +0000
committerajs <ajs>2004-11-20 02:06:59 +0000
commit6099b3b56956322567323c11fd698b2328c6826b (patch)
treefa537bd0eaa9f7d824f39445eabc928db59050ca /lib
parentae5e24d8678f1e3a60dde58d3382c5ba73d6bb27 (diff)
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/buffer.c2
-rw-r--r--lib/command.c2
-rw-r--r--lib/memory.c2
-rw-r--r--lib/pid_output.c2
-rw-r--r--lib/privs.c20
-rw-r--r--lib/smux.c6
-rw-r--r--lib/sockopt.c4
-rw-r--r--lib/sockunion.c10
-rw-r--r--lib/thread.c2
-rw-r--r--lib/vty.c12
10 files changed, 31 insertions, 31 deletions
diff --git a/lib/buffer.c b/lib/buffer.c
index 3701e121..296fd144 100644
--- a/lib/buffer.c
+++ b/lib/buffer.c
@@ -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;
}
diff --git a/lib/command.c b/lib/command.c
index fc115d95..6c02c96e 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -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;
}
diff --git a/lib/memory.c b/lib/memory.c
index a5c327db..6eb135f0 100644
--- a/lib/memory.c
+++ b/lib/memory.c
@@ -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();
}
diff --git a/lib/pid_output.c b/lib/pid_output.c
index fca7ec83..2782b9d4 100644
--- a/lib/pid_output.c
+++ b/lib/pid_output.c
@@ -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);
}
diff --git a/lib/privs.c b/lib/privs.c
index 71e2c7fe..66681dab 100644
--- a/lib/privs.c
+++ b/lib/privs.c
@@ -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);
}
}
diff --git a/lib/smux.c b/lib/smux.c
index 25786090..33efccde 100644
--- a/lib/smux.c
+++ b/lib/smux.c
@@ -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)
diff --git a/lib/sockopt.c b/lib/sockopt.c
index 2afa3c80..786e1528 100644
--- a/lib/sockopt.c
+++ b/lib/sockopt.c
@@ -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;
}
diff --git a/lib/sockunion.c b/lib/sockunion.c
index 78e02f26..7157b49c 100644
--- a/lib/sockunion.c
+++ b/lib/sockunion.c
@@ -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;
}
diff --git a/lib/thread.c b/lib/thread.c
index 09d6ff73..89df06a0 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -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;
}
diff --git a/lib/vty.c b/lib/vty.c
index 3e10a947..016e52a9 100644
--- 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;
}