commit f1683459ab74d68e6ffb9e92687aab8aa7619c32
parent 4388f861d5cc17ef801a399aa31012f5e73e6080
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:
1 file changed, 5 insertions(+), 4 deletions(-)
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);