From 44eb81cfa388c2139682dbd71d18c41fc3ce9041 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sun, 4 Oct 2009 10:38:45 +0000 Subject: [PATCH] * don't continue to read, if we don't have a valid FD --- libcitadel/lib/stringbuf.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libcitadel/lib/stringbuf.c b/libcitadel/lib/stringbuf.c index 463f978b5..5b4a20907 100644 --- a/libcitadel/lib/stringbuf.c +++ b/libcitadel/lib/stringbuf.c @@ -1847,7 +1847,9 @@ int StrBufTCP_read_buffered_line_fast(StrBuf *Line, IsNonBlock = (fdflags & O_NONBLOCK) == O_NONBLOCK; pch = NULL; - while ((nSuccessLess < timeout) && (pch == NULL)) { + while ((nSuccessLess < timeout) && + (pch == NULL) && + (*fd != -1)) { if (IsNonBlock) { tv.tv_sec = 1; @@ -1943,7 +1945,9 @@ int StrBufReadBLOB(StrBuf *Buf, int *fd, int append, long nBytes, const char **E fdflags = fcntl(*fd, F_GETFL); IsNonBlock = (fdflags & O_NONBLOCK) == O_NONBLOCK; nSuccessLess = 0; - while (nRead < nBytes) { + while ((nRead < nBytes) && + (*fd != -1)) + { if (IsNonBlock) { tv.tv_sec = 1; @@ -2072,7 +2076,8 @@ int StrBufReadBLOBBuffered(StrBuf *Blob, SelRes = 1; nBytes -= nRead; nRead = 0; - while (nRead < nBytes) { + while ((nRead < nBytes) && + (*fd != -1)) { if (IsNonBlock) { tv.tv_sec = 1; -- 2.39.2