[BACK]Return to syslogd.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / usr.sbin / syslogd

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/usr.sbin/syslogd/syslogd.c between version 1.55 and 1.56

version 1.55, 2002/08/02 02:23:49 version 1.56, 2002/09/24 13:53:54
Line 83  __RCSID("$NetBSD$");
Line 83  __RCSID("$NetBSD$");
 #include <sys/un.h>  #include <sys/un.h>
 #include <sys/wait.h>  #include <sys/wait.h>
   
   #include <netinet/in.h>
   
 #include <ctype.h>  #include <ctype.h>
 #include <errno.h>  #include <errno.h>
 #include <fcntl.h>  #include <fcntl.h>
Line 1494  socksetup(int af)
Line 1496  socksetup(int af)
 {  {
         struct addrinfo hints, *res, *r;          struct addrinfo hints, *res, *r;
         int error, maxs, *s, *socks;          int error, maxs, *s, *socks;
           const int on = 1;
   
         if(SecureMode && !NumForwards)          if(SecureMode && !NumForwards)
                 return(NULL);                  return(NULL);
Line 1512  socksetup(int af)
Line 1515  socksetup(int af)
         /* Count max number of sockets we may open */          /* Count max number of sockets we may open */
         for (maxs = 0, r = res; r; r = r->ai_next, maxs++)          for (maxs = 0, r = res; r; r = r->ai_next, maxs++)
                 continue;                  continue;
         socks = malloc ((maxs+1) * sizeof(int));          socks = malloc((maxs+1) * sizeof(int));
         if (!socks) {          if (!socks) {
                 logerror("Couldn't allocate memory for sockets");                  logerror("Couldn't allocate memory for sockets");
                 die(0);                  die(0);
         }          }
   
         *socks = 0;   /* num of sockets counter at start of array */          *socks = 0;   /* num of sockets counter at start of array */
         s = socks+1;          s = socks + 1;
         for (r = res; r; r = r->ai_next) {          for (r = res; r; r = r->ai_next) {
                 *s = socket(r->ai_family, r->ai_socktype, r->ai_protocol);                  *s = socket(r->ai_family, r->ai_socktype, r->ai_protocol);
                 if (*s < 0) {                  if (*s < 0) {
                         logerror("socket() failed");                          logerror("socket() failed");
                         continue;                          continue;
                 }                  }
                   if (r->ai_family == AF_INET6 && setsockopt(*s, IPPROTO_IPV6,
                       IPV6_V6ONLY, &on, sizeof(on)) < 0) {
                           logerror("setsockopt(IPV6_V6ONLY) failed");
                           close(*s);
                           continue;
                   }
                 if (!SecureMode && bind(*s, r->ai_addr, r->ai_addrlen) < 0) {                  if (!SecureMode && bind(*s, r->ai_addr, r->ai_addrlen) < 0) {
                         logerror("bind() failed");                          logerror("bind() failed");
                         close (*s);                          close (*s);

Legend:
Removed from v.1.55  
changed lines
  Added in v.1.56

CVSweb <webmaster@jp.NetBSD.org>