Browse Source

* source/mcast : fix socket creation

master
Alex 'AdUser' Z 8 years ago
parent
commit
7ea2066dde
  1. 6
      src/sources/mcast.c

6
src/sources/mcast.c

@ -127,6 +127,7 @@ start(cfg_t *cfg) {
return false;
}
cfg->sock = -1;
for (struct addrinfo *rp = result; rp != NULL; rp = rp->ai_next) {
if (sock >= 0) {
close(sock); /* from prev iteration */
@ -175,14 +176,15 @@ start(cfg_t *cfg) {
strerror(errno));
continue;
}
cfg->sock = sock;
sock = -1;
break; /* success */
}
freeaddrinfo(result);
if (sock < 0)
if (cfg->sock < 0)
return false;
cfg->sock = sock;
return true;
}

Loading…
Cancel
Save