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

Loading…
Cancel
Save