www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1999/11/24/19:16:37

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-developers-unsubscribe-archive-cygwin-developers=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Subscribe: <mailto:cygwin-developers-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-developers-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com
To: cygwin-developers AT sourceware DOT cygnus DOT com
Subject: cygwin_bind bug.
Mime-Version: 1.0 (generated by tm-edit 7.106)
From: Kazuhiro Fujieda <fujieda AT jaist DOT ac DOT jp>
Date: 25 Nov 1999 09:16:17 +0900
Message-ID: <s1s903npgry.fsf@jaist.ac.jp>
Lines: 41
X-Mailer: Gnus v5.3/Emacs 19.34

cygwin_bind() with AF_UNIX can return 0 even though it fails.

ChangeLog:
Thu Nov 25 08:55:42 1999  Kazuhiro Fujieda <fujieda AT jaist DOT ac DOT 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 AT jaist DOT ac DOT jp>
  | HOKURIKU  School of Information Science
o_/ 1990      Japan Advanced Institute of Science and Technology

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019