tgetlistenfd: reorder + minor cleanup - geomyidae - A small C-based gopherd. (gopher://bitreich.org/1/scm/geomyidae) (HTM) git clone git://r-36.net/geomyidae (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit 7474d9bd62ae23a8bd355aaf83be9fe9a9693d4d (DIR) parent 8d9bad389a4ac22fc292f92d0128af8679e640fa (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org> 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(-) --- (DIR) diff --git a/main.c b/main.c 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,