Commit:    0549e55d8233c1a0fb3eaf42bf88265f9b0fa5d0
Author:    Remi Collet <r...@php.net>         Fri, 3 May 2013 08:19:14 +0200
Parents:   444e59eb2071e8c2d2bcb61bb1e2404dd3b780cf
Branches:  PHP-5.3 PHP-5.4 PHP-5.5 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=0549e55d8233c1a0fb3eaf42bf88265f9b0fa5d0

Log:
From code coverity scan, syscall return value must be check.

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.

Changed paths:
  M  sapi/fpm/fpm/fpm_log.c
  M  sapi/fpm/fpm/fpm_signals.c
  M  sapi/fpm/fpm/fpm_sockets.c
  M  sapi/fpm/fpm/fpm_stdio.c


Diff:
diff --git a/sapi/fpm/fpm/fpm_log.c b/sapi/fpm/fpm/fpm_log.c
index 303acb2..4e1a057 100644
--- a/sapi/fpm/fpm/fpm_log.c
+++ b/sapi/fpm/fpm/fpm_log.c
@@ -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;
diff --git a/sapi/fpm/fpm/fpm_signals.c b/sapi/fpm/fpm/fpm_signals.c
index 8993a86..c5d0692 100644
--- a/sapi/fpm/fpm/fpm_signals.c
+++ b/sapi/fpm/fpm/fpm_signals.c
@@ -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;
 }
diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c
index df94967..3dcad4e 100644
--- a/sapi/fpm/fpm/fpm_sockets.c
+++ b/sapi/fpm/fpm/fpm_sockets.c
@@ -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) {
diff --git a/sapi/fpm/fpm/fpm_stdio.c b/sapi/fpm/fpm/fpm_stdio.c
index ebe43a2..10b867d 100644
--- a/sapi/fpm/fpm/fpm_stdio.c
+++ b/sapi/fpm/fpm/fpm_stdio.c
@@ -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;
 }
 /* }}} */


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to