diff options
author | Omar Polo <op@omarpolo.com> | 2023-08-04 09:57:27 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2023-08-04 09:57:27 +0000 |
commit | d671434bc76ec81a34e64ae0c164a831cbee4b0d (patch) | |
tree | ecac181dcf758c7524646a056bb47420b713dcd2 /titan.c | |
parent | 59051566657ab3888ef841cf46cf0588bf57e746 (diff) |
titan: better logging for unexpected EOFs
upon an unexpected EOF, tls_error() returns NULL, so log the real
reason iomux returned -1.
Diffstat (limited to 'titan.c')
-rw-r--r-- | titan.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -347,8 +347,12 @@ main(int argc, char **argv) buflen = fread(buf, 1, sizeof(buf), in); w = iomux(ctx, sock, buf, buflen, resbuf, sizeof(resbuf)); - if (w == -1) - errx(1, "I/O error: %s", tls_error(ctx)); + if (w == -1) { + errstr = tls_error(ctx); + if (errstr == NULL) + errstr = "unexpected EOF"; + errx(1, "I/O error: %s", errstr); + } if (w != 0) { if ((m = memmem(resbuf, w, "\r\n", 2)) == NULL) errx(1, "invalid reply"); |