minissdpc.c: fix variable redeclaration of p

This commit is contained in:
Thomas Bernard 2019-04-10 14:15:33 +02:00
parent 1ef1deec01
commit 5ae326a95e
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C
1 changed files with 18 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $Id: minissdpc.c,v 1.32 2016/10/07 09:04:36 nanard Exp $ */ /* $Id: minissdpc.c,v 1.39 2019/04/10 12:09:17 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab /* vim: tabstop=4 shiftwidth=4 noexpandtab
* Project : miniupnp * Project : miniupnp
* Web : http://miniupnp.free.fr/ * Web : http://miniupnp.free.fr/
@ -492,7 +492,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
struct sockaddr_storage sockudp_w; struct sockaddr_storage sockudp_w;
#else #else
int rv; int rv;
struct addrinfo hints, *servinfo, *p; struct addrinfo hints, *servinfo;
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
unsigned long _ttl = (unsigned long)ttl; unsigned long _ttl = (unsigned long)ttl;
@ -817,7 +817,8 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv)); fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
#endif #endif
break; break;
} } else {
struct addrinfo *p;
for(p = servinfo; p; p = p->ai_next) { for(p = servinfo; p; p = p->ai_next) {
n = sendto(sudp, bufr, n, 0, p->ai_addr, MSC_CAST_INT p->ai_addrlen); n = sendto(sudp, bufr, n, 0, p->ai_addr, MSC_CAST_INT p->ai_addrlen);
if (n < 0) { if (n < 0) {
@ -835,6 +836,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
} }
} }
freeaddrinfo(servinfo); freeaddrinfo(servinfo);
}
if(!sentok) { if(!sentok) {
if(error) if(error)
*error = MINISSDPC_SOCKET_ERROR; *error = MINISSDPC_SOCKET_ERROR;