This is the mail archive of the cygwin-developers@sourceware.cygnus.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]

Re: cygwin_bind bug.


Is this patch against the latest snapshot?  Corinna has submitted
some changes to some of this code recently.  It is in the latest
snapshot.

cgf

On Thu, Nov 25, 1999 at 09:16:17AM +0900, Kazuhiro Fujieda wrote:
>cygwin_bind() with AF_UNIX can return 0 even though it fails.
>
>ChangeLog:
>Thu Nov 25 08:55:42 1999  Kazuhiro Fujieda <fujieda@jaist.ac.jp>
>	* net.cc (cygwin_bind): Return -1 properly if it fails on AF_UNIX.
>
>--- net.cc-	Thu Nov 25 08:31:53 1999
>+++ net.cc	Thu Nov 25 08:55:42 1999
>@@ -757,6 +757,7 @@ cygwin_bind (int fd, struct sockaddr *my
> 	  struct sockaddr_in sin;
> 	  int len = sizeof sin;
> 	  int fd;
>+	  int inet_res;
> 
>           if (strlen (un_addr->sun_path) >= UNIX_PATH_LEN)
>             {
>@@ -766,15 +767,15 @@ cygwin_bind (int fd, struct sockaddr *my
> 	  sin.sin_family = AF_INET;
> 	  sin.sin_port = 0;
> 	  sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
>-	  res = bind (sock->get_socket (), (sockaddr *) &sin, len);
>-	  if (res)
>+	  inet_res = bind (sock->get_socket (), (sockaddr *) &sin, len);
>+	  if (inet_res)
> 	    {
> 	      set_winsock_errno ();
> 	      syscall_printf ("AF_UNIX: bind failed %d", get_errno ());
> 	      goto out;
> 	    }
>-	  res = getsockname (sock->get_socket (), (sockaddr *) &sin, &len);
>-	  if (res)
>+	  inet_res = getsockname (sock->get_socket (), (sockaddr *) &sin, &len);
>+	  if (inet_res)
> 	    {
> 	      set_winsock_errno ();
> 	      syscall_printf ("AF_UNIX: getsockname failed %d", get_errno ());
>
>____
>  | AIST      Kazuhiro Fujieda <fujieda@jaist.ac.jp>
>  | HOKURIKU  School of Information Science
>o_/ 1990      Japan Advanced Institute of Science and Technology

-- 
cgf@cygnus.com
http://www.cygnus.com/

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