From 0b3bf4b1d898b4e438fe4959a63fc16211baff12 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 9 Jun 2000 07:30:22 +0000 Subject: Use SUN_LEN() for length of UNIX domain addresses. This should fix problems with connection to clients on libc5 machines. --- client/client.c | 2 +- sysdep/unix/io.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/client.c b/client/client.c index 8b01ce3..a139b04 100644 --- a/client/client.c +++ b/client/client.c @@ -250,7 +250,7 @@ server_connect(void) bzero(&sa, sizeof(sa)); sa.sun_family = AF_UNIX; strcpy(sa.sun_path, server_path); - if (connect(server_fd, (struct sockaddr *) &sa, sizeof(struct sockaddr)) < 0) + if (connect(server_fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) < 0) die("Unable to connect to server control socket (%s): %m", server_path); if (fcntl(server_fd, F_SETFL, O_NONBLOCK) < 0) die("fcntl: %m"); diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index 445bc7c..7f37c08 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -774,7 +774,7 @@ sk_open_unix(sock *s, char *name) unlink(name); sa.sun_family = AF_UNIX; strcpy(sa.sun_path, name); - if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) + if (bind(fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) < 0) ERR("bind"); if (listen(fd, 8)) ERR("listen"); -- cgit v1.2.3