Browse Source

2005-01-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* daemon.c: (daemon) Replace perror with zlog_err.
	* vty.c: (vty_serv_un) Replace perror with zlog_err.
	* ripd.c: (rip_create_socket) Replace perror with zlog_err.
	* ioctl.c: (if_ioctl,if_ioctl_ipv6,if_get_flags) Replace perror with
	  zlog_err.
	* ioctl_solaris.c: (if_ioctl,if_ioctl_ipv6) Replace perror with
	  zlog_err.
ajs 15 years ago
parent
commit
6a52d0d155
8 changed files with 33 additions and 11 deletions
  1. 5 0
      lib/ChangeLog
  2. 2 2
      lib/daemon.c
  3. 3 3
      lib/vty.c
  4. 4 0
      ripd/ChangeLog
  5. 1 1
      ripd/ripd.c
  6. 7 0
      zebra/ChangeLog
  7. 6 3
      zebra/ioctl.c
  8. 5 2
      zebra/ioctl_solaris.c

+ 5 - 0
lib/ChangeLog

@@ -1,3 +1,8 @@
+2005-01-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+	* daemon.c: (daemon) Replace perror with zlog_err.
+	* vty.c: (vty_serv_un) Replace perror with zlog_err.
+
 2005-01-29 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
 	* buffer.h: Fix comment on buffer_getstr to reflect that it now

+ 2 - 2
lib/daemon.c

@@ -35,7 +35,7 @@ daemon (int nochdir, int noclose)
   /* In case of fork is error. */
   if (pid < 0)
     {
-      perror ("fork");
+      zlog_err ("fork failed: %s", safe_strerror(errno));
       return -1;
     }
 
@@ -48,7 +48,7 @@ daemon (int nochdir, int noclose)
 
   if (pid == -1)
     {
-      perror ("setsid");
+      zlog_err ("setsid failed: %s", safe_strerror(errno));
       return -1;
     }
 

+ 3 - 3
lib/vty.c

@@ -1824,7 +1824,7 @@ vty_serv_un (const char *path)
   sock = socket (AF_UNIX, SOCK_STREAM, 0);
   if (sock < 0)
     {
-      perror ("sock");
+      zlog_err("Cannot create unix stream socket: %s", safe_strerror(errno));
       return;
     }
 
@@ -1841,7 +1841,7 @@ vty_serv_un (const char *path)
   ret = bind (sock, (struct sockaddr *) &serv, len);
   if (ret < 0)
     {
-      perror ("bind");
+      zlog_err("Cannot bind path %s: %s", path, safe_strerror(errno));
       close (sock);	/* Avoid sd leak. */
       return;
     }
@@ -1849,7 +1849,7 @@ vty_serv_un (const char *path)
   ret = listen (sock, 5);
   if (ret < 0)
     {
-      perror ("listen");
+      zlog_err("listen(fd %d) failed: %s", sock, safe_strerror(errno));
       close (sock);	/* Avoid sd leak. */
       return;
     }

+ 4 - 0
ripd/ChangeLog

@@ -1,5 +1,9 @@
 2005-01-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
+	* ripd.c: (rip_create_socket) Replace perror with zlog_err.
+
+2005-01-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
 	* ripd.c: (rip_create_socket) Save errno before calling
 	  ripd_privs.change.
 

+ 1 - 1
ripd/ripd.c

@@ -1985,7 +1985,7 @@ rip_create_socket ()
   sock = socket (AF_INET, SOCK_DGRAM, 0);
   if (sock < 0) 
     {
-      perror ("socket");
+      zlog_err("Cannot create UDP socket: %s", safe_strerror(errno));
       exit (1);
     }
 

+ 7 - 0
zebra/ChangeLog

@@ -1,3 +1,10 @@
+2005-01-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+	* ioctl.c: (if_ioctl,if_ioctl_ipv6,if_get_flags) Replace perror with
+	  zlog_err.
+	* ioctl_solaris.c: (if_ioctl,if_ioctl_ipv6) Replace perror with
+	  zlog_err.
+
 2005-01-29 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
 	* if_ioctl_solaris.c: (interface_list_ioctl) Save errno before calling

+ 6 - 3
zebra/ioctl.c

@@ -54,9 +54,10 @@ if_ioctl (u_long request, caddr_t buffer)
   sock = socket (AF_INET, SOCK_DGRAM, 0);
   if (sock < 0)
     {
+      int save_errno = errno;
       if (zserv_privs.change(ZPRIVS_LOWER))
         zlog (NULL, LOG_ERR, "Can't lower privileges");
-      perror ("socket");
+      zlog_err("Cannot create UDP socket: %s", safe_strerror(save_errno));
       exit (1);
     }
   if ((ret = ioctl (sock, request, buffer)) < 0)
@@ -86,9 +87,11 @@ if_ioctl_ipv6 (u_long request, caddr_t buffer)
   sock = socket (AF_INET6, SOCK_DGRAM, 0);
   if (sock < 0)
     {
+      int save_errno = errno;
       if (zserv_privs.change(ZPRIVS_LOWER))
         zlog (NULL, LOG_ERR, "Can't lower privileges");
-      perror ("socket");
+      zlog_err("Cannot create IPv6 datagram socket: %s",
+	       safe_strerror(save_errno));
       exit (1);
     }
 
@@ -343,7 +346,7 @@ if_get_flags (struct interface *ifp)
   ret = if_ioctl (SIOCGIFFLAGS, (caddr_t) &ifreq);
   if (ret < 0) 
     {
-      perror ("ioctl");
+      zlog_err("if_ioctl(SIOCGIFFLAGS) failed: %s", safe_strerror(errno));
       return;
     }
 

+ 5 - 2
zebra/ioctl_solaris.c

@@ -55,9 +55,10 @@ if_ioctl (u_long request, caddr_t buffer)
   sock = socket (AF_INET, SOCK_DGRAM, 0);
   if (sock < 0)
     {
+      int save_errno = errno;
       if (zserv_privs.change(ZPRIVS_LOWER))
         zlog (NULL, LOG_ERR, "Can't lower privileges");
-      perror ("socket");
+      zlog_err("Cannot create UDP socket: %s", safe_strerror(save_errno));
       exit (1);
     }
 
@@ -92,9 +93,11 @@ if_ioctl_ipv6 (u_long request, caddr_t buffer)
   sock = socket (AF_INET6, SOCK_DGRAM, 0);
   if (sock < 0)
     {
+      int save_errno = errno;
       if (zserv_privs.change(ZPRIVS_LOWER))
         zlog (NULL, LOG_ERR, "Can't lower privileges");
-      perror ("socket");
+      zlog_err("Cannot create IPv6 datagram socket: %s",
+	       safe_strerror(save_errno));
       exit (1);
     }