From 61b01299b2db886e16bfe18b5d9e6c3eb02d02f4 Mon Sep 17 00:00:00 2001 From: Isaac Boukris Date: Mon, 28 Sep 2015 03:58:53 +0300 Subject: [PATCH] GUAC-1361: listen() need not be present in main loop See GUAC-1361. Signed-off-by: Isaac Boukris --- src/guacd/daemon.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/guacd/daemon.c b/src/guacd/daemon.c index 89c607f9..9233fa57 100644 --- a/src/guacd/daemon.c +++ b/src/guacd/daemon.c @@ -607,17 +607,17 @@ int main(int argc, char* argv[]) { /* Free addresses */ freeaddrinfo(addresses); + /* Listen for connections */ + if (listen(socket_fd, 5) < 0) { + guacd_log(GUAC_LOG_ERROR, "Could not listen on socket: %s", strerror(errno)); + return 3; + } + /* Daemon loop */ for (;;) { pid_t child_pid; - /* Listen for connections */ - if (listen(socket_fd, 5) < 0) { - guacd_log(GUAC_LOG_ERROR, "Could not listen on socket: %s", strerror(errno)); - return 3; - } - /* Accept connection */ client_addr_len = sizeof(client_addr); connected_socket_fd = accept(socket_fd,