From: Remi Collet Date: Fri, 3 May 2013 06:19:14 +0000 (+0200) Subject: From code coverity scan, syscall return value must be check. X-Git-Tag: php-5.3.26RC1~15^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0549e55d8233c1a0fb3eaf42bf88265f9b0fa5d0;p=php 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. --- diff --git a/sapi/fpm/fpm/fpm_log.c b/sapi/fpm/fpm/fpm_log.c index 303acb2186..4e1a057db1 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 8993a860ae..c5d0692f18 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 df94967db1..3dcad4e70f 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 ebe43a278d..10b867d00a 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; } /* }}} */