summaryrefslogtreecommitdiff
path: root/src/reqs.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2013-11-22 18:27:24 +0100
committerMichael Adam <obnox@samba.org>2013-11-22 18:49:45 +0100
commit9efa5799f00c55c2215c2d9af9242b91611dc718 (patch)
tree3e539ec05344881138c069379dbdf11725ccba55 /src/reqs.c
parentc27b6d15e269ea674e28375fec134850a14bbb63 (diff)
downloadtinyproxy-9efa5799f00c55c2215c2d9af9242b91611dc718.tar.gz
tinyproxy-9efa5799f00c55c2215c2d9af9242b91611dc718.zip
reqs: Fix CID 1130968 - unchecked return value from library
Check the return code of fcntl via socket_nonblocking in pull_client_data() Found by coverity. Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'src/reqs.c')
-rw-r--r--src/reqs.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/reqs.c b/src/reqs.c
index 5144a12..fcf1f09 100644
--- a/src/reqs.c
+++ b/src/reqs.c
@@ -500,6 +500,7 @@ static int pull_client_data (struct conn_s *connptr, long int length)
{
char *buffer;
ssize_t len;
+ int ret;
buffer =
(char *) safemalloc (min (MAXBUFFSIZE, (unsigned long int) length));
@@ -525,7 +526,13 @@ static int pull_client_data (struct conn_s *connptr, long int length)
* return and line feed) at the end of a POST message. These
* need to be eaten for tinyproxy to work correctly.
*/
- socket_nonblocking (connptr->client_fd);
+ ret = socket_nonblocking (connptr->client_fd);
+ if (ret != 0) {
+ log_message(LOG_ERR, "Failed to set the client socket "
+ "to non-blocking: %s", strerror(errno));
+ goto ERROR_EXIT;
+ }
+
len = recv (connptr->client_fd, buffer, 2, MSG_PEEK);
socket_blocking (connptr->client_fd);