about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/connect.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-12-26 10:00:22 +0000
committerRoland McGrath <roland@gnu.org>1995-12-26 10:00:22 +0000
commitbe7e3b7e7ef0fb3d632002bda04d0ad0537ced8b (patch)
treeed3701064cddf156aed81b7799617ecc031f6e1c /sysdeps/mach/hurd/connect.c
parente0f09b6b2a5a06ee90f962d79aad21274152d052 (diff)
downloadglibc-be7e3b7e7ef0fb3d632002bda04d0ad0537ced8b.tar.gz
glibc-be7e3b7e7ef0fb3d632002bda04d0ad0537ced8b.tar.xz
glibc-be7e3b7e7ef0fb3d632002bda04d0ad0537ced8b.zip
Mon Dec 25 20:56:39 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> cvs/libc-951228 cvs/libc-951227 cvs/libc-951226
	* sysdeps/mach/hurd/bind.c: Translate EEXIST from dir_link into
	EADDRINUSE.  If translated node doesn't grok ifsock protocol,
	return EADDRINUSE.

	* sysdeps/mach/hurd/connect.c: Make address arg
	`const struct sockaddr_un *'.
	The redecl is kosher and avoids another variable for AF_LOCAL case.
	* sysdeps/mach/hurd/sendto.c: Likewise.
	* sysdeps/mach/hurd/bind.c: Likewise.

	* socket/sys/socket.h (__SOCKADDR_ARG): Enable transparent_union
 	code for GCC >= 2.7; use __transparent_union__ for name safety;
 	add several sockaddr flavors.
	(__SOCKADDR_ALLTYPES, __SOCKADDR_ONETYPE): New macros used in
	constructing the transparent union declarations.
	(__CONST_SOCKADDR_ARG): New type (or macro if not GCC 2.7).
	(bind, connect, sendto): Make the sockaddr argument use that.
Diffstat (limited to 'sysdeps/mach/hurd/connect.c')
-rw-r--r--sysdeps/mach/hurd/connect.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/sysdeps/mach/hurd/connect.c b/sysdeps/mach/hurd/connect.c
index 019d1ea108..0ecf7369ed 100644
--- a/sysdeps/mach/hurd/connect.c
+++ b/sysdeps/mach/hurd/connect.c
@@ -31,17 +31,16 @@ Cambridge, MA 02139, USA.  */
    Return 0 on success, -1 for errors.  */
 int
 DEFUN(connect, (fd, addr, len),
-      int fd AND struct sockaddr *addr AND size_t len)
+      int fd AND const struct sockaddr_un *addr AND size_t len)
 {
   error_t err;
   addr_port_t aport;
-  
-  if (addr->sa_family == AF_LOCAL)
+
+  if (addr->sun_family == AF_LOCAL)
     {
       /* For the local domain, we must look up the name as a file and talk
 	 to it with the ifsock protocol.  */
-      struct sockaddr_un *unaddr = (struct sockaddr_un *) addr;
-      file_t file = __file_name_lookup (unaddr->sun_path, 0, 0);
+      file_t file = __file_name_lookup (addr->sun_path, 0, 0);
       if (file == MACH_PORT_NULL)
 	return -1;
       err = __ifsock_getsockaddr (file, &aport);
@@ -54,12 +53,12 @@ DEFUN(connect, (fd, addr, len),
     }
   else
     err = EIEIO;
-    
+
   err = HURD_DPORT_USE (fd,
 			({
 			  if (err)
 			    err = __socket_create_address (port,
-							   addr->sa_family,
+							   addr->sun_family,
 							   (char *) addr, len,
 							   &aport);
 			  if (! err)