From 12a134c66b045b18c777f3797436ef015e4c4669 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 21 Feb 2017 17:05:52 +1100 Subject: [PATCH] Check for !ret set before checking errno as it may not be set and cached from a previous error. --- src/generator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generator.c b/src/generator.c index 85705a47..525c7ec5 100644 --- a/src/generator.c +++ b/src/generator.c @@ -1756,7 +1756,7 @@ static void send_json_msgq(gdata_t *gdata, cs_msg_t **csmsgq) fd = proxy->cs.fd; ret = send(fd, csmsg->buf + csmsg->ofs, csmsg->len, MSG_DONTWAIT); if (ret < 1) { - if (errno == EAGAIN || errno == EWOULDBLOCK || !ret) + if (!ret || errno == EAGAIN || errno == EWOULDBLOCK) break; csmsg->len = 0; LOGNOTICE("Proxy %d:%d %s failed to send msg in send_json_msgq, dropping",