From 59f21d19e81a313c2348eb124f601dbcb88cbfb1 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Sun, 9 Jun 2002 15:52:16 +0000 Subject: [PATCH] Fixed the length arguments in bind() and connect() to use the SIZEOF_SOCKADDR macro. --- CHANGES | 6 ++++++ lib/silcutil/unix/silcunixnet.c | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 25d5d7e0..6cf77e46 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +Sun Jun 9 18:58:25 EEST 2002 Pekka Riikonen + + * The length arguments in bind() and connect() were wrong + and fixed now to used SIZEOF_SOCKADDR in the + lib/silcutil/unix/silcunixutil.c. + Tue Jun 4 18:36:05 EEST 2002 Pekka Riikonen * Fixed detach timeout handling to use Client ID and not diff --git a/lib/silcutil/unix/silcunixnet.c b/lib/silcutil/unix/silcunixnet.c index 31c11370..b753ac51 100644 --- a/lib/silcutil/unix/silcunixnet.c +++ b/lib/silcutil/unix/silcunixnet.c @@ -191,11 +191,11 @@ int silc_net_create_connection(const char *local_ip, int port, /* Set sockaddr for local listener, and try to bind it. */ if (silc_net_set_sockaddr(&local, local_ip, 0)) - bind(sock, &local.sa, sizeof(local)); + bind(sock, &local.sa, SIZEOF_SOCKADDR(local)); } /* Connect to the host */ - rval = connect(sock, &desthost.sa, sizeof(desthost)); + rval = connect(sock, &desthost.sa, SIZEOF_SOCKADDR(desthost)); if (rval < 0) { SILC_LOG_ERROR(("Cannot connect to remote host: %s", strerror(errno))); shutdown(sock, 2); @@ -262,14 +262,14 @@ int silc_net_create_connection_async(const char *local_ip, int port, /* Set sockaddr for local listener, and try to bind it. */ if (silc_net_set_sockaddr(&local, local_ip, 0)) - bind(sock, &local.sa, sizeof(local)); + bind(sock, &local.sa, SIZEOF_SOCKADDR(local)); } /* Set the socket to non-blocking mode */ silc_net_set_socket_nonblock(sock); /* Connect to the host */ - rval = connect(sock, &desthost.sa, sizeof(desthost)); + rval = connect(sock, &desthost.sa, SIZEOF_SOCKADDR(desthost)); if (rval < 0) { if (errno != EINPROGRESS) { SILC_LOG_ERROR(("Cannot connect to remote host: %s", strerror(errno))); -- 2.43.0