]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix getsockname() foobar. Noriyuki Soda <soda@sra.co.jp>
authorwessels <>
Thu, 14 Nov 1996 09:56:38 +0000 (09:56 +0000)
committerwessels <>
Thu, 14 Nov 1996 09:56:38 +0000 (09:56 +0000)
src/main.cc

index d602319308ff32129f9cebf6d0b8bd1c749f3653..6b44a26366a49319524d9baac72aa9c81eee3d48 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: main.cc,v 1.111 1996/11/13 06:52:24 wessels Exp $
+ * $Id: main.cc,v 1.112 1996/11/14 02:56:38 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -319,6 +319,7 @@ static void
 serverConnectionsOpen(void)
 {
     struct in_addr addr;
+    struct sockaddr_in xaddr;
     u_short port;
     int len;
     int x;
@@ -385,13 +386,16 @@ serverConnectionsOpen(void)
            } else {
                theOutIcpConnection = theInIcpConnection;
            }
+           memset(&theOutICPAddr, '\0', sizeof(struct in_addr));
            len = sizeof(struct sockaddr_in);
+           memset(&xaddr, '\0', len);
            x = getsockname(theOutIcpConnection,
-               (struct sockaddr *) &theOutICPAddr,
-               &len);
+               (struct sockaddr *) &xaddr, &len);
            if (x < 0)
                debug(1, 1, "theOutIcpConnection FD %d: getsockname: %s\n",
                    theOutIcpConnection, xstrerror());
+           else
+               theOutICPAddr = xaddr.sin_addr;
        }
     }
     clientdbInit();