commit d671434bc76ec81a34e64ae0c164a831cbee4b0d from: Omar Polo date: Fri Aug 04 09:57:27 2023 UTC titan: better logging for unexpected EOFs upon an unexpected EOF, tls_error() returns NULL, so log the real reason iomux returned -1. commit - 59051566657ab3888ef841cf46cf0588bf57e746 commit + d671434bc76ec81a34e64ae0c164a831cbee4b0d blob - 9b8e4639d4fc0b92950b8580bee8977779d83039 blob + e57ff67bbcef362e3a9763f72900a5475009c2ee --- titan.c +++ titan.c @@ -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");