From: wessels <> Date: Thu, 14 Nov 1996 09:56:38 +0000 (+0000) Subject: Fix getsockname() foobar. Noriyuki Soda X-Git-Tag: SQUID_3_0_PRE1~5471 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=651ca9d8c944509ea10a9b2bd2ed1781aeff364d;p=thirdparty%2Fsquid.git Fix getsockname() foobar. Noriyuki Soda --- diff --git a/src/main.cc b/src/main.cc index d602319308..6b44a26366 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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();