Return fd in mud_bind()
This commit is contained in:
6
mud.c
6
mud.c
@@ -176,8 +176,10 @@ int mud_bind (struct mud *mud, const char *host, const char *port)
|
|||||||
if (!ai)
|
if (!ai)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
int fd;
|
||||||
|
|
||||||
for (p=ai; p; p=p->ai_next) {
|
for (p=ai; p; p=p->ai_next) {
|
||||||
int fd = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
|
fd = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
|
||||||
|
|
||||||
if (fd==-1)
|
if (fd==-1)
|
||||||
continue;
|
continue;
|
||||||
@@ -195,7 +197,7 @@ int mud_bind (struct mud *mud, const char *host, const char *port)
|
|||||||
if (!p)
|
if (!p)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fake
|
// fake
|
||||||
|
|||||||
Reference in New Issue
Block a user