use tls_error for tls_read errors - geomyidae - A small C-based gopherd. HTML git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit f1683459ab74d68e6ffb9e92687aab8aa7619c32 DIR parent 4388f861d5cc17ef801a399aa31012f5e73e6080 HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Sun, 7 Jun 2020 21:22:14 +0200 use tls_error for tls_read errors Signed-off-by: Christoph Lohmann <20h@r-36.net> Diffstat: M main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- DIR diff --git a/main.c b/main.c @@ -764,15 +764,16 @@ main(int argc, char *argv[]) if (istls) { retl = tls_read(tlsclientctx, recvb+rlen, sizeof(recvb)-1-rlen); + if (retl < 0) + fprintf(stderr, "tls_read failed: %s\n", tls_error(tlsclientctx)); } else { retl = read(sock, recvb+rlen, sizeof(recvb)-1-rlen); - } - if (retl <= 0) { if (retl < 0) - perror("recv"); - break; + perror("read"); } + if (retl <= 0) + break; rlen += retl; } while (recvb[rlen-1] != '\n' && --maxrecv > 0);