Bump copyright date
[privoxy.git] / jbsockets.c
index 7c3ab07..5622651 100644 (file)
@@ -1,4 +1,4 @@
-const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.108 2011/07/30 15:12:02 fabiankeil Exp $";
+const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.113 2012/03/09 16:23:50 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jbsockets.c,v $
@@ -168,7 +168,7 @@ jb_socket connect_to(const char *host, int portnum, struct client_state *csp)
       {
          log_error(LOG_LEVEL_ERROR,
             "Attempt %d of %d to connect to %s failed. Trying again.",
-            forwarded_connect_retries, csp->config->forwarded_connect_retries, host);
+            forwarded_connect_retries, csp->config->forwarded_connect_retries + 1, host);
       }
 
    } while (forwarded_connect_retries < csp->config->forwarded_connect_retries);
@@ -976,6 +976,16 @@ void get_host_information(jb_socket afd, char **ip_address, char **port,
          log_error(LOG_LEVEL_ERROR, "getsockname() truncated server address");
          return;
       }
+/*
+ * XXX: Workaround for missing header on Windows when
+ *      configured with --disable-ipv6-support.
+ *      The proper fix is to not use NI_MAXSERV in
+ *      that case. It works by accident on other platforms
+ *      as <netdb.h> in included unconditionally there.
+ */
+#ifndef NI_MAXSERV
+#define NI_MAXSERV 32
+#endif
       *port = malloc(NI_MAXSERV);
       if (NULL == *port)
       {
@@ -1006,7 +1016,6 @@ void get_host_information(jb_socket afd, char **ip_address, char **port,
 #else
       *ip_address = strdup(inet_ntoa(server.sin_addr));
       snprintf(*port, NI_MAXSERV, "%hu", ntohs(server.sin_port));
-      *port[NI_MAXSERV - 1] = '\0';
 #endif /* HAVE_RFC2553 */
       if (NULL == hostname)
       {
@@ -1333,11 +1342,7 @@ unsigned long resolve_hostname_to_ip(const char *host)
          log_error(LOG_LEVEL_ERROR, "hostname %s resolves to unknown address type.", host);
          return(INADDR_NONE);
       }
-      memcpy(
-         (char *) &inaddr.sin_addr,
-         (char *) hostp->h_addr,
-         sizeof(inaddr.sin_addr)
-      );
+      memcpy((char *)&inaddr.sin_addr, (char *)hostp->h_addr, sizeof(inaddr.sin_addr));
    }
    return(inaddr.sin_addr.s_addr);