]> sjero.net Git - wget/blobdiff - src/connect.c
[svn] Avoid unneeded initialization of local var.
[wget] / src / connect.c
index e2bacf40e41f2d24aa7cf2d6da8cd06303b326ca..ff7a741c2c198b6c2e348251595447bb178af474 100644 (file)
@@ -87,6 +87,7 @@ sockaddr_set_data (struct sockaddr *sa, const ip_address *ip, int port)
     case IPV4_ADDRESS:
       {
        struct sockaddr_in *sin = (struct sockaddr_in *)sa;
+       xzero (*sin);
        sin->sin_family = AF_INET;
        sin->sin_port = htons (port);
        sin->sin_addr = ADDRESS_IPV4_IN_ADDR (ip);
@@ -96,6 +97,7 @@ sockaddr_set_data (struct sockaddr *sa, const ip_address *ip, int port)
     case IPV6_ADDRESS:
       {
        struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa;
+       xzero (*sin6);
        sin6->sin6_family = AF_INET6;
        sin6->sin6_port = htons (port);
        sin6->sin6_addr = ADDRESS_IPV6_IN6_ADDR (ip);
@@ -259,7 +261,7 @@ connect_to_ip (const ip_address *ip, int port, const char *print)
 {
   struct sockaddr_storage ss;
   struct sockaddr *sa = (struct sockaddr *)&ss;
-  int sock = -1;
+  int sock;
 
   /* If PRINT is non-NULL, print the "Connecting to..." line, with
      PRINT being the host name we're connecting to.  */
@@ -428,13 +430,6 @@ bind_local (const ip_address *bind_address, int *port)
   setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, setopt_ptr, setopt_size);
 #endif
 
-#ifdef ENABLE_IPV6
-# ifdef HAVE_IPV6_V6ONLY
-  if (family == AF_INET6)
-    setsockopt (sock, IPPROTO_IPV6, IPV6_V6ONLY, setopt_ptr, setopt_size);
-# endif
-#endif
-
   xzero (ss);
   sockaddr_set_data (sa, bind_address, *port);
   if (bind (sock, sa, sockaddr_size (sa)) < 0)
@@ -878,8 +873,8 @@ fd_read (int fd, char *buf, int bufsize, double timeout)
     return sock_read (fd, buf, bufsize);
 }
 
-/* The same as xread, but don't actually read the data, just copy it
-   instead.  */
+/* The same as fd_read, but don't actually read the data, just find out
+   what's the number of bytes available for reading.  */
 
 int
 fd_peek (int fd, char *buf, int bufsize, double timeout)