diff --git a/ncat/ncat_listen.c b/ncat/ncat_listen.c index 4a3a7a2ce..34c3bb8dc 100644 --- a/ncat/ncat_listen.c +++ b/ncat/ncat_listen.c @@ -274,7 +274,8 @@ static int ncat_listen_stream(int proto) /* setup the main listening socket */ listen_socket[num_sockets] = do_listen(SOCK_STREAM, proto, &listenaddrs[i]); if (listen_socket[num_sockets] == -1) { - logdebug("do_listen(\"%s\"): %s\n", inet_ntop_ez(&listenaddrs[i].storage, sizeof(listenaddrs[i].storage)), socket_strerror(socket_errno())); + if (o.debug > 0) + logdebug("do_listen(\"%s\"): %s\n", inet_ntop_ez(&listenaddrs[i].storage, sizeof(listenaddrs[i].storage)), socket_strerror(socket_errno())); continue; } @@ -681,7 +682,8 @@ static int ncat_listen_dgram(int proto) /* create the UDP listen sockets */ sockfd[num_sockets].fd = do_listen(SOCK_DGRAM, proto, &listenaddrs[i]); if (sockfd[num_sockets].fd == -1) { - logdebug("do_listen(\"%s\"): %s\n", inet_ntop_ez(&listenaddrs[i].storage, sizeof(listenaddrs[i].storage)), socket_strerror(socket_errno())); + if (o.debug > 0) + logdebug("do_listen(\"%s\"): %s\n", inet_ntop_ez(&listenaddrs[i].storage, sizeof(listenaddrs[i].storage)), socket_strerror(socket_errno())); continue; } FD_SET(sockfd[num_sockets].fd, &listen_fds); diff --git a/ncat/ncat_main.c b/ncat/ncat_main.c index 949fed0ad..ea22a6ff6 100644 --- a/ncat/ncat_main.c +++ b/ncat/ncat_main.c @@ -939,7 +939,7 @@ static int ncat_listen_mode(void) rc = resolve("::", o.portno, &listenaddrs[num_listenaddrs].storage, &ss_len, AF_INET6); if (rc == 0) num_listenaddrs++; - else + else if (o.debug > 0) logdebug("Failed to resolve default IPv6 address: %s\n", gai_strerror(rc)); } #endif diff --git a/ncat/ncat_proxy.c b/ncat/ncat_proxy.c index 8757e5244..9b2701390 100644 --- a/ncat/ncat_proxy.c +++ b/ncat/ncat_proxy.c @@ -221,7 +221,8 @@ int ncat_http_server(void) for (i = 0; i < num_listenaddrs; i++) { listen_socket[num_sockets] = do_listen(SOCK_STREAM, IPPROTO_TCP, &listenaddrs[i]); if (listen_socket[num_sockets] == -1) { - logdebug("do_listen(\"%s\"): %s\n", inet_ntop_ez(&listenaddrs[i].storage, sizeof(listenaddrs[i].storage)), socket_strerror(socket_errno())); + if (o.debug > 0) + logdebug("do_listen(\"%s\"): %s\n", inet_ntop_ez(&listenaddrs[i].storage, sizeof(listenaddrs[i].storage)), socket_strerror(socket_errno())); continue; }