From 0af894df064f8385a55f236016155cb580cb65c8 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Mon, 28 Jan 2013 18:34:58 +0100 Subject: [PATCH] core: log when fcntl() fails Reported by Coverity as CID #970967, #970966. --- core/utils.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/utils.c b/core/utils.c index 81715b3b..7a24ed5e 100644 --- a/core/utils.c +++ b/core/utils.c @@ -936,7 +936,9 @@ int wsgi_req_simple_accept(struct wsgi_request *wsgi_req, int fd) { // set close on exec (if not a new socket) if (!wsgi_req->socket->edge_trigger && uwsgi.close_on_exec) { - fcntl(wsgi_req->poll.fd, F_SETFD, FD_CLOEXEC); + if (fcntl(wsgi_req->poll.fd, F_SETFD, FD_CLOEXEC) < 0) { + uwsgi_error("fcntl()"); + } } return 0; @@ -1041,7 +1043,9 @@ int wsgi_req_accept(int queue, struct wsgi_request *wsgi_req) { if (!uwsgi_sock->edge_trigger) { if (uwsgi.close_on_exec) { - fcntl(wsgi_req->poll.fd, F_SETFD, FD_CLOEXEC); + if (fcntl(wsgi_req->poll.fd, F_SETFD, FD_CLOEXEC) < 0) { + uwsgi_error("fcntl()"); + } } }