This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

BUG in sendto() function


hello cygwin,

I think there is a bug in your networking code. Sendto can't send
packet to AF_UNIX socket reporting "Addresses in the specified family
cannot be used with this socket").

Socket is creating with this code:

####################################################################################
  if ((incoming_pipe_fd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0)
  {
     LOG_SYS(0,("ERROR: Can't create unix domain socket for IPC pipe...\n"));
     exit(EXIT_ERROR_FATAL);
  }
  
  bzero((char*)&ip_serv_addr, sizeof(ip_serv_addr));
  ip_serv_addr.sun_family = AF_UNIX;
  snprintf(ip_serv_addr.sun_path, sizeof(ip_serv_addr.sun_path)-1,
           "%s/pipe_inc.%u", lp_var_path(), lp_udp_port());
           
  DEBUG(90, ("Binding pipe socket to: %s\n", ip_serv_addr.sun_path));
  
  ip_saddrlen = sizeof(ip_serv_addr.sun_family) + strlen(ip_serv_addr.sun_path)+1;

  if (unlink(ip_serv_addr.sun_path) == 0)
  {
     LOG_SYS(0, ("Init: Unix socket (incoming) exist: unclean shutdown?...\n"));
  }

  if (bind(incoming_pipe_fd, (struct sockaddr *)&ip_serv_addr, ip_saddrlen) < 0)
  {
     LOG_SYS(0, ("ERROR: Can't bind pipe socket to special file...\n"));
     exit(EXIT_ERROR_FATAL);
  }
  
  chmod(ip_serv_addr.sun_path, 0600);
}
####################################################################################

I included information about my system.
This code works fine on FreeBSD, Linux, Solaris, Irix.

-- 
With respect,
Alexandr V. Shutko                           mailto:AVShutko@mail.khstu.ru

cygcheck.out.gz

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]