BUG in sendto() function

Alexandr V. Shutko AVShutko@mail.khstu.ru
Sat Oct 6 03:34:00 GMT 2001


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/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out.gz
Type: application/x-gzip
Size: 2294 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20011006/c69e5c07/attachment.bin>


More information about the Cygwin mailing list