From 952787031182876d7a79b3e5399cf27979318f43 Mon Sep 17 00:00:00 2001 From: "Torrance, Douglas" Date: Fri, 1 Mar 2019 10:48:49 +0000 Subject: [PATCH] wmbiff: Remove unnecessary loop. The last release of wmbiff included a patch by Nye Liu from Debian bug #917467 [1]. However, the second part of that patch is not necessary. From Andreas Metzler's comment I am not sure about the second part of the patch. I understand wmbiff breaking on GNUTLS_E_AGAIN from gnutls_read, because this only started to happen recently (with TLS1.3) on blocking sockets. What I do not get from my rudimentary understanding C programmimg is the second part, this is in the else of "if (scs->tls_state)", so, afaiui for non-encrypted connections. Is the change necessary there at all, is it the right thing to retry read on EAGAIN then? We revert the second part of the patch. [1] https://bugs.debian.org/917467 --- wmbiff/wmbiff/tlsComm.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/wmbiff/wmbiff/tlsComm.c b/wmbiff/wmbiff/tlsComm.c index f37f3f5..7497295 100644 --- a/wmbiff/wmbiff/tlsComm.c +++ b/wmbiff/wmbiff/tlsComm.c @@ -242,11 +242,9 @@ tlscomm_expect(struct connection_state *scs, } else #endif { - do { - thisreadbytes = - read(scs->sd, &scs->unprocessed[buffered_bytes], - BUF_SIZE - 1 - buffered_bytes); - } while (thisreadbytes == EAGAIN); + thisreadbytes = + read(scs->sd, &scs->unprocessed[buffered_bytes], + BUF_SIZE - 1 - buffered_bytes); if (thisreadbytes < 0) { TDM(DEBUG_ERROR, "%s: error reading: %s\n", scs->name, strerror(errno));