X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/0f85bdecaba4806c0f06ee89d7ec084cc015bb19..5382473b0e690398304eab989a3e2a5f1158bb68:/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)