Fixed the length arguments in bind() and connect() to use the
authorPekka Riikonen <priikone@silcnet.org>
Sun, 9 Jun 2002 15:52:16 +0000 (15:52 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sun, 9 Jun 2002 15:52:16 +0000 (15:52 +0000)
SIZEOF_SOCKADDR macro.

CHANGES
lib/silcutil/unix/silcunixnet.c

diff --git a/CHANGES b/CHANGES
index 25d5d7e04cb9f82a0189264a286a5d875d506bda..6cf77e464cd71c308364130702e3d58f80259538 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+Sun Jun  9 18:58:25 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
+
+       * 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 <priikone@silcnet.org>
 
        * Fixed detach timeout handling to use Client ID and not
index 31c11370a4a4a5a6d7d65d0246ebc464ed0c7538..b753ac5118be0430f4e795e63adb38611527835b 100644 (file)
@@ -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)));