coverity 160162 check fcntl return
authorAndy Green <andy@warmcat.com>
Fri, 22 Apr 2016 23:59:38 +0000 (07:59 +0800)
committerAndy Green <andy@warmcat.com>
Sat, 23 Apr 2016 00:16:18 +0000 (08:16 +0800)
Signed-off-by: Andy Green <andy@warmcat.com>
lib/libwebsockets.c

index 018783509395c9c594c5fa85677396b1a128b565..468dea6470d13c776512967089eecece9b066e7a 100644 (file)
@@ -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++) {