]> granicus.if.org Git - php/commitdiff
Revert "Revert "Remove a few unused write warning""
authorBob Weinand <bobwei9@hotmail.com>
Sun, 20 Nov 2016 18:18:50 +0000 (19:18 +0100)
committerBob Weinand <bobwei9@hotmail.com>
Sun, 20 Nov 2016 18:18:50 +0000 (19:18 +0100)
This reverts commit ff5a65d26b139142c5e967582c369ef65b79adf8.

(With zend_ prefix now)

Zend/zend_portability.h
sapi/fpm/fpm/fpm_log.c
sapi/fpm/fpm/fpm_main.c
sapi/fpm/fpm/fpm_signals.c
sapi/fpm/fpm/zlog.c
sapi/phpdbg/phpdbg.c
sapi/phpdbg/phpdbg.h
sapi/phpdbg/phpdbg_io.c
sapi/phpdbg/phpdbg_sigsafe.c

index f1871294166c47117e76da8b8ad06df4202fdbde..02f58d987855769fd8348b8375dfa846c48e8345 100644 (file)
 # define ZEND_IGNORE_VALUE(x) ((void) (x))
 #endif
 
+#define zend_quiet_write(...) ZEND_IGNORE_VALUE(write(__VA_ARGS__))
+
 /* all HAVE_XXX test have to be after the include of zend_config above */
 
 #if defined(HAVE_LIBDL) && !defined(ZEND_WIN32)
index 5aad9a08c9e1738fe118226438f7c28eff031b0e..9f63d7a34c104b752e7cfa111c1b243c978fa49f 100644 (file)
@@ -467,7 +467,7 @@ int fpm_log_write(char *log_format) /* {{{ */
 
        if (!test && strlen(buffer) > 0) {
                buffer[len] = '\n';
-               write(fpm_log_fd, buffer, len + 1);
+               zend_quiet_write(fpm_log_fd, buffer, len + 1);
        }
 
        return 0;
index 5adeb63b7a18028a4e43654e429dbd3556dca237..c0b4b1c7544617316069e35bf5d52196400dd4e3 100644 (file)
@@ -1865,7 +1865,7 @@ consult the installation file that came with this distribution, or visit \n\
                if (fpm_globals.send_config_pipe[1]) {
                        int writeval = 0;
                        zlog(ZLOG_DEBUG, "Sending \"0\" (error) to parent via fd=%d", fpm_globals.send_config_pipe[1]);
-                       write(fpm_globals.send_config_pipe[1], &writeval, sizeof(writeval));
+                       zend_quiet_write(fpm_globals.send_config_pipe[1], &writeval, sizeof(writeval));
                        close(fpm_globals.send_config_pipe[1]);
                }
                return FPM_EXIT_CONFIG;
@@ -1874,7 +1874,7 @@ consult the installation file that came with this distribution, or visit \n\
        if (fpm_globals.send_config_pipe[1]) {
                int writeval = 1;
                zlog(ZLOG_DEBUG, "Sending \"1\" (OK) to parent via fd=%d", fpm_globals.send_config_pipe[1]);
-               write(fpm_globals.send_config_pipe[1], &writeval, sizeof(writeval));
+               zend_quiet_write(fpm_globals.send_config_pipe[1], &writeval, sizeof(writeval));
                close(fpm_globals.send_config_pipe[1]);
        }
        fpm_is_running = 1;
index a637e69e71949ff361765b0bead06682396dbb11..e9f49d9e47d1fd5ad3a91ce1370b7b87eb44dd78 100644 (file)
@@ -174,7 +174,7 @@ static void sig_handler(int signo) /* {{{ */
 
        saved_errno = errno;
        s = sig_chars[signo];
-       write(sp[1], &s, sizeof(s));
+       zend_quiet_write(sp[1], &s, sizeof(s));
        errno = saved_errno;
 }
 /* }}} */
index 1659c77efcaea2952af97708bf6d09522db13c55..4884dca856b5f2c20488ef086e8c335895daaa81 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "zlog.h"
 #include "fpm.h"
+#include "zend_portability.h"
 
 #define MAX_LINE_LENGTH 1024
 
@@ -186,11 +187,11 @@ void vzlog(const char *function, int line, int flags, const char *fmt, va_list a
 #endif
        {
                buf[len++] = '\n';
-               write(zlog_fd > -1 ? zlog_fd : STDERR_FILENO, buf, len);
+               zend_quiet_write(zlog_fd > -1 ? zlog_fd : STDERR_FILENO, buf, len);
        }
 
        if (zlog_fd != STDERR_FILENO && zlog_fd != -1 && !launched && (flags & ZLOG_LEVEL_MASK) >= ZLOG_NOTICE) {
-               write(STDERR_FILENO, buf, len);
+               zend_quiet_write(STDERR_FILENO, buf, len);
        }
 }
 /* }}} */
index a62b40907273c4bd1d95f2f69765253dc0f24912..148e18a454b7d745a53457fc72a51ee7db60a0ac 100644 (file)
@@ -1939,7 +1939,7 @@ phpdbg_main:
                        if (PHPDBG_G(ops)) {
                                phpdbg_print_opcodes(print_opline_func);
                        } else {
-                               quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("No opcodes could be compiled | No file specified or compilation failed?\n"));
+                               zend_quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("No opcodes could be compiled | No file specified or compilation failed?\n"));
                        }
                        goto phpdbg_out;
                }
index 94c5471e22d8e4b35a5d310c51f7ef4a459de10f..3df2be0aed51ef05554810b36f1328328bb18c8d 100644 (file)
 #define memcpy(...) memcpy_tmp(__VA_ARGS__)
 #endif
 
-#define quiet_write(...) ZEND_IGNORE_VALUE(write(__VA_ARGS__))
-
 #if !defined(PHPDBG_WEBDATA_TRANSFER_H) && !defined(PHPDBG_WEBHELPER_H)
 
 #ifdef ZTS
index b2f4ba7c0d8ad5a51ee7ccec747323b53854246f..65a14d0ccba58b0808a8e4152ed17dba604ffb25 100644 (file)
@@ -149,7 +149,7 @@ recv_once:
 #endif
 
                if (got_now == -1) {
-                       quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("Read operation timed out!\n"));
+                       zend_quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("Read operation timed out!\n"));
                        return -1;
                }
                i -= got_now;
@@ -203,7 +203,7 @@ static int phpdbg_output_pager(int sock, const char *ptr, int len) {
                        
                        if (memchr(p, '\n', endp - p)) {
                                char buf[PHPDBG_MAX_CMD];
-                               write(sock, ZEND_STRL("\r---Type <return> to continue or q <return> to quit---"));
+                               zend_quiet_write(sock, ZEND_STRL("\r---Type <return> to continue or q <return> to quit---"));
                                phpdbg_consume_stdin_line(buf);
                                if (*buf == 'q') {
                                        break;
@@ -305,7 +305,7 @@ PHPDBG_API int phpdbg_create_listenable_socket(const char *addr, unsigned short
 
                                wrote = snprintf(buf, 128, "Could not translate address '%s'", addr);
                                buf[wrote] = '\0';
-                               quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, buf, strlen(buf));
+                               zend_quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, buf, strlen(buf));
 
                                return sock;
                        } else {
@@ -315,7 +315,7 @@ PHPDBG_API int phpdbg_create_listenable_socket(const char *addr, unsigned short
 
                                wrote = snprintf(buf, 256, "Host '%s' not found. %s", addr, estrdup(gai_strerror(rc)));
                                buf[wrote] = '\0';
-                               quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, buf, strlen(buf));
+                               zend_quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, buf, strlen(buf));
 
                                return sock;
 #ifndef PHP_WIN32
@@ -330,7 +330,7 @@ PHPDBG_API int phpdbg_create_listenable_socket(const char *addr, unsigned short
 
                        wrote = sprintf(buf, "Unable to create socket");
                        buf[wrote] = '\0';
-                       quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, buf, strlen(buf));
+                       zend_quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, buf, strlen(buf));
 
                        return sock;
                }
index 2f987b3a154e4086f92b1ad3099e61655356f100..081d864c5c9a52ca16300ad609b3218d78f17f76 100644 (file)
@@ -13,13 +13,13 @@ static void* zend_mm_mem_alloc(zend_mm_storage *storage, size_t size, size_t ali
                return (void *) (((size_t) PHPDBG_G(sigsafe_mem).mem & ~(alignment - 1)) + alignment);
        }
 
-       quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("Tried to allocate more than " EXP_STR(PHPDBG_SIGSAFE_MEM_SIZE) " bytes from stack memory in signal handler ... bailing out of signal handler\n"));
+       zend_quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("Tried to allocate more than " EXP_STR(PHPDBG_SIGSAFE_MEM_SIZE) " bytes from stack memory in signal handler ... bailing out of signal handler\n"));
 
        if (*EG(bailout)) {
                LONGJMP(*EG(bailout), FAILURE);
        }
 
-       quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("Bailed out without a bailout address in signal handler!\n"));
+       zend_quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("Bailed out without a bailout address in signal handler!\n"));
 
        return NULL;
 }