Use HAVE_SOCK_SIN_LEN and set ->sin_len
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 1 Jun 2011 11:31:40 +0000 (21:31 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 1 Jun 2011 11:31:40 +0000 (21:31 +1000)
for legacy unixens (AIX)
so that we will compile and run on those systems with a "weird"
sockaddr_in definition.

lib/socket.c

index 1de64b6b454a42a937bea4fb0f05008e023f46dc..d4354bb4972eaf07366ac474f46aa6b17cb59618 100644 (file)
@@ -251,8 +251,11 @@ int rpc_connect_async(struct rpc_context *rpc, const char *server, int port, rpc
 
        switch (s.ss_family) {
        case AF_INET:
-               rpc->fd = socket(AF_INET, SOCK_STREAM, 0);
                socksize = sizeof(struct sockaddr_in);
+#ifdef HAVE_SOCK_SIN_LEN
+               sin->sin_len = socksize;
+#endif
+               rpc->fd = socket(AF_INET, SOCK_STREAM, 0);
                break;
        }