From 6c8d9de3cc50e1bbb0415e5e32edf2173e6e60ba Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 22 Nov 2013 18:30:30 +0100 Subject: [PATCH] reqs: Fix CID 1130967 - unchecked return value from library. Check the return code of fcntl via socket_blocking in pull_client_data(). Found by coverity. Signed-off-by: Michael Adam (cherry picked from commit 0a998034253ccd7239777fa362a830b46b6630c6) --- src/reqs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/reqs.c b/src/reqs.c index caec89c..3c5eae6 100644 --- a/src/reqs.c +++ b/src/reqs.c @@ -527,7 +527,13 @@ static int pull_client_data (struct conn_s *connptr, long int length) */ socket_nonblocking (connptr->client_fd); len = recv (connptr->client_fd, buffer, 2, MSG_PEEK); - socket_blocking (connptr->client_fd); + + ret = socket_blocking (connptr->client_fd); + if (ret != 0) { + log_message(LOG_ERR, "Failed to set the client socket " + "to blocking: %s", strerror(errno)); + goto ERROR_EXIT; + } if (len < 0 && errno != EAGAIN) goto ERROR_EXIT;