]> granicus.if.org Git - php/commitdiff
From code coverity scan, syscall return value must be check.
authorRemi Collet <remi@php.net>
Fri, 3 May 2013 06:19:14 +0000 (08:19 +0200)
committerRemi Collet <remi@php.net>
Fri, 3 May 2013 06:19:14 +0000 (08:19 +0200)
To not alter current behaviour, we simply log the problem,
so, if it occurs, the message will give explanation.

This are only warning as they don't block the server,
but such fail can explain strange (not expected) behaviour later.

sapi/fpm/fpm/fpm_log.c
sapi/fpm/fpm/fpm_signals.c
sapi/fpm/fpm/fpm_sockets.c
sapi/fpm/fpm/fpm_stdio.c

index 303acb218654b8a0293e3c052a90670cd4eb0793..4e1a057db19835f281837f690bd542faabeab259 100644 (file)
@@ -57,7 +57,9 @@ int fpm_log_open(int reopen) /* {{{ */
                        wp->log_fd = fd;
                }
 
-               fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
+               if (0 > fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC)) {
+                       zlog(ZLOG_WARNING, "failed to change attribute of access_log");
+               }
        }
 
        return ret;
index 8993a860ae87d4ac375e42e955ba4ed8925a0100..c5d0692f182d71b9197e05c2434170713de49013 100644 (file)
@@ -145,7 +145,9 @@ static void sig_soft_quit(int signo) /* {{{ */
 
        /* closing fastcgi listening socket will force fcgi_accept() exit immediately */
        close(0);
-       socket(AF_UNIX, SOCK_STREAM, 0);
+       if (0 > socket(AF_UNIX, SOCK_STREAM, 0)) {
+               zlog(ZLOG_WARNING, "failed to create a new socket");
+       }
        fpm_php_soft_quit();
        errno = saved_errno;
 }
index df94967db127ebaa1560563d7da53eb63444f885..3dcad4e70f979de60384dee471913a14f591ba16 100644 (file)
@@ -176,7 +176,9 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct
                return -1;
        }
 
-       setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags));
+       if (0 > setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags))) {
+               zlog(ZLOG_WARNING, "failed to change socket attribute");
+       }
 
        if (wp->listen_address_domain == FPM_AF_UNIX) {
                if (fpm_socket_unix_test_connect((struct sockaddr_un *)sa, socklen) == 0) {
index ebe43a278d38f77b8f321b4ae748722c62e6d435..10b867d00a414a0dcf964789a4ec8045446e9f56 100644 (file)
@@ -295,7 +295,9 @@ int fpm_stdio_open_error_log(int reopen) /* {{{ */
                        zlog_set_fd(fpm_globals.error_log_fd);
                }
        }
-       fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
+       if (0 > fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC)) {
+               zlog(ZLOG_WARNING, "failed to change attribute of error_log");
+       }
        return 0;
 }
 /* }}} */