| Date: Wed, 29 Aug 2018 20:16:43 +0200
getlistenfd: reorder + minor cleanup
Signed-off-by: Christoph Lohmann <20h@r-36.net>
Diffstat:
main.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
--- |
| t@@ -298,13 +298,10 @@ getlistenfd(struct addrinfo *hints, char *bindip, char *port)
void *sinaddr;
int on, listfd;
- listfd = -1;
-
- if (getaddrinfo(bindip, port, hints, &ai))
- return -1;
- if (ai == NULL)
+ if (getaddrinfo(bindip, port, hints, &ai) || ai == NULL)
return -1;
+ listfd = -1;
on = 1;
for (rp = ai; rp != NULL; rp = rp->ai_next) {
listfd = socket(rp->ai_family, rp->ai_socktype, |