commit 151075427d0da4e4100e905c04e63063474437d9 parent c772b64413c3fb40d14fe8b5c204057e28efda3e Author: sin <sin@2f30.org> Date: Fri, 31 Mar 2017 14:24:29 +0100 Error out correctly if we fail to bind the socket Diffstat:
M | server.c | | | 6 | ++++-- |
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/server.c b/server.c @@ -47,9 +47,11 @@ serverinit(char *host, char *port) } break; } - if (!p) - logwarnx("failed to bind socket"); freeaddrinfo(ai); + if (!p) { + logwarnx("failed to bind socket"); + return -1; + } return listenfd; }