diff options
author | Minun Dragonation <minun@mewmew.cn> | 2019-05-05 21:39:46 +0800 |
---|---|---|
committer | Minun Dragonation <minun@mewmew.cn> | 2019-05-05 21:39:46 +0800 |
commit | 82252440de09067d46772da727dbc69c2e83fcf1 (patch) | |
tree | d331e6dd5603e6232b2d30e60e10fcb2d6dd2705 | |
parent | d8f814d48b25e202065b5a2b829cd0c2c20d29d3 (diff) |
fix bugs on ref address incorrect on sockcompact with getsockopt
-rw-r--r-- | sockcompat.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sockcompat.c b/sockcompat.c index 047f8b6..7e5b6a7 100644 --- a/sockcompat.c +++ b/sockcompat.c @@ -192,9 +192,8 @@ int win32_getsockopt(SOCKET sockfd, int level, int optname, void *optval, sockle int ret = 0; if ((level == SOL_SOCKET) && ((optname == SO_RCVTIMEO) || (optname == SO_SNDTIMEO))) { struct timeval *tv = (struct timeval *)optval; - DWORD timeout = 0; - socklen_t dwlen = 0; - ret = getsockopt(sockfd, level, optname, (char *)timeout, &dwlen); + DWORD timeout = 0; socklen_t dwlen = 0; + ret = getsockopt(sockfd, level, optname, (char *)&timeout, &dwlen); tv->tv_sec = timeout / 1000; tv->tv_usec = timeout * 1000; *optlen = sizeof (struct timeval); |