From a2757c74b17e8b2a0dd759198be7f82ae57e3f45 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sat, 23 Apr 2016 07:59:38 +0800 Subject: [PATCH] coverity 160162 check fcntl return Signed-off-by: Andy Green --- lib/libwebsockets.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 01878350..468dea64 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -1767,7 +1767,10 @@ lws_cgi(struct lws *wsi, const char * const *exec_array, int script_uri_path_len /* read side is 0, stdin we want the write side, others read */ cgi->stdwsi[n]->sock = cgi->pipe_fds[n][!!(n == 0)]; - fcntl(cgi->pipe_fds[n][!!(n == 0)], F_SETFL, O_NONBLOCK); + if (fcntl(cgi->pipe_fds[n][!!(n == 0)], F_SETFL, O_NONBLOCK) < 0) { + lwsl_err("%s: setting NONBLOCK failed\n", __func__); + goto bail2; + } } for (n = 0; n < 3; n++) {