From 3038e93b7e2e34296429a078b70205448c81e6cb Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Wed, 12 Jun 2019 21:58:47 +0100 Subject: Don't print server or client recv() errors to the terminal, debugprint() them properly instead. --- blabouncer.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/blabouncer.c b/blabouncer.c index bbb22cd..567de57 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -544,13 +544,9 @@ void dochat(int *serversockfd, int *clientsockfd, struct settings *settings) { debugprint(DEBUG_FULL, "reading server socket!\n"); if ((servernumbytes = sockread(server_ssl, serverbuf, MAXRCVSIZE - 1, settings->servertls)) == -1) { - perror("recv"); - printf("receive error (-1), skipping loop iteration...\n"); - debugprint(DEBUG_CRIT, "serversockfd receive error (-1), skipping loop iteration, errno '%d'.\n"); + debugprint(DEBUG_CRIT, "dochat(): server sockread() error (-1) (%s), skipping loop iteration.\n", strerror(errno)); } else if (servernumbytes == 0) { - perror("recv"); - printf("socket closed (or no data received) (0), skipping loop iteration...\n"); - debugprint(DEBUG_CRIT, "serversockfd socket closed (or no data received) (0), skipping loop iteration, errno '%d'.\n"); + debugprint(DEBUG_CRIT, "dochat(): server sockread() closed or no data received (0) (%s), skipping loop iteration.\n", strerror(errno)); } // If there was a socket error (receive error or socket closed) @@ -723,8 +719,7 @@ void dochat(int *serversockfd, int *clientsockfd, struct settings *settings) { // connection closed debugprint(DEBUG_SOME, "bouncer-client: socket %d hung up\n", i); } else { - perror("recv"); - debugprint(DEBUG_CRIT, "bouncer-client: socket error, clientnum bytes '%d', errno '%d'.\n", clientnumbytes, errno); + debugprint(DEBUG_CRIT, "dochat(): client sockread() error (%s) (%s).\n", clientnumbytes, strerror(errno)); } // Disconnect the client disconnectclient(i, clients, &ircdstate, settings); -- cgit v1.2.3