From 52b3a28b8821f0beee3a483a5dac088ea5a94771 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 4 Jan 2016 22:36:16 +1100 Subject: [PATCH] Check regularly for an invalidated file handle in read_socket_line --- src/ckpool.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ckpool.c b/src/ckpool.c index dad5a817..367ee9db 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -560,9 +560,6 @@ int read_socket_line(connsock_t *cs, float *timeout) int ret = -1; float diff; - if (unlikely(cs->fd < 0)) - goto out; - clear_bufline(cs); eom = strchr(cs->buf, '\n'); @@ -571,6 +568,11 @@ int read_socket_line(connsock_t *cs, float *timeout) while (!eom) { char readbuf[PAGESIZE]; + if (unlikely(cs->fd < 0)) { + ret = -1; + goto out; + } + if (*timeout < 0) { if (cs->ckp->proxy) LOGINFO("Timed out in read_socket_line");