From: Adam Dickmeiss Date: Tue, 19 Jan 2010 12:12:39 +0000 (+0100) Subject: WIN32: dont mess with peer address X-Git-Tag: v4.0.0~12^2 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=1122ba757b75750168f0ee748748b3bdc20dcd8b;p=yaz-moved-to-github.git WIN32: dont mess with peer address For some reason we never got accept on Windows to return a peer address. This change just ensure we don't work with it (uninitialized variable addr). --- diff --git a/src/tcpip.c b/src/tcpip.c index bd4db34..d72bc44 100644 --- a/src/tcpip.c +++ b/src/tcpip.c @@ -751,8 +751,12 @@ int tcpip_listen(COMSTACK h, char *raddr, int *addrlen, int (*check_ip)(void *cd, const char *a, int len, int t), void *cd) { +#ifdef WIN32 + /* we don't get peer address on Windows (via accept) */ +#else struct sockaddr_in addr; YAZ_SOCKLEN_T len = sizeof(addr); +#endif TRC(fprintf(stderr, "tcpip_listen pid=%d\n", getpid())); if (h->state != CS_ST_IDLE) @@ -792,6 +796,10 @@ int tcpip_listen(COMSTACK h, char *raddr, int *addrlen, } return -1; } +#ifdef WIN32 + if (addrlen) + *addrlen = 0; +#else if (addrlen && (size_t) (*addrlen) >= sizeof(struct sockaddr_in)) memcpy(raddr, &addr, *addrlen = sizeof(struct sockaddr_in)); else if (addrlen) @@ -808,6 +816,7 @@ int tcpip_listen(COMSTACK h, char *raddr, int *addrlen, h->newfd = -1; return -1; } +#endif h->state = CS_ST_INCON; return 0; }