X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/ec7ce23c79c375acc6a8930fc03dcef76488ba7e..1a20ccb84089a46e7a9e73ade70c3cbce58bfadb:/cli.c?ds=inline diff --git a/cli.c b/cli.c index 9433106..3a037fa 100644 --- a/cli.c +++ b/cli.c @@ -286,11 +286,19 @@ void init_cli(char *hostname) addr.sin_addr.s_addr = config->cli_bind_address; /* defaults to INADDR_ANY */ addr.sin_port = htons(23); if (bind(clifd, (void *) &addr, sizeof(addr)) < 0) + { + LOG(0, 0, 0, "Error binding cli on port 23: %s\n", strerror(errno)); + close(clifd); + clifd = -1; + return; + } + if (listen(clifd, 10) < 0) { LOG(0, 0, 0, "Error listening on cli port 23: %s\n", strerror(errno)); + close(clifd); + clifd = -1; return; } - listen(clifd, 10); } void cli_do(int sockfd)