summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2016-11-20 19:18:50 +0100
committerBob Weinand <bobwei9@hotmail.com>2016-11-20 19:18:50 +0100
commitbc30206b8ad4975126bd36f48add769d0d9a221a (patch)
treede9accd1aaa58cf9a25293cb9290bac1d6576a26
parentff5a65d26b139142c5e967582c369ef65b79adf8 (diff)
downloadphp-git-bc30206b8ad4975126bd36f48add769d0d9a221a.tar.gz
Revert "Revert "Remove a few unused write warning""
This reverts commit ff5a65d26b139142c5e967582c369ef65b79adf8. (With zend_ prefix now)
-rw-r--r--Zend/zend_portability.h2
-rw-r--r--sapi/fpm/fpm/fpm_log.c2
-rw-r--r--sapi/fpm/fpm/fpm_main.c4
-rw-r--r--sapi/fpm/fpm/fpm_signals.c2
-rw-r--r--sapi/fpm/fpm/zlog.c5
-rw-r--r--sapi/phpdbg/phpdbg.c2
-rw-r--r--sapi/phpdbg/phpdbg.h2
-rw-r--r--sapi/phpdbg/phpdbg_io.c10
-rw-r--r--sapi/phpdbg/phpdbg_sigsafe.c4
9 files changed, 17 insertions, 16 deletions
diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h
index f187129416..02f58d9878 100644
--- a/Zend/zend_portability.h
+++ b/Zend/zend_portability.h
@@ -125,6 +125,8 @@
# 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)
diff --git a/sapi/fpm/fpm/fpm_log.c b/sapi/fpm/fpm/fpm_log.c
index 5aad9a08c9..9f63d7a34c 100644
--- a/sapi/fpm/fpm/fpm_log.c
+++ b/sapi/fpm/fpm/fpm_log.c
@@ -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;
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
index 5adeb63b7a..c0b4b1c754 100644
--- a/sapi/fpm/fpm/fpm_main.c
+++ b/sapi/fpm/fpm/fpm_main.c
@@ -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;
diff --git a/sapi/fpm/fpm/fpm_signals.c b/sapi/fpm/fpm/fpm_signals.c
index a637e69e71..e9f49d9e47 100644
--- a/sapi/fpm/fpm/fpm_signals.c
+++ b/sapi/fpm/fpm/fpm_signals.c
@@ -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;
}
/* }}} */
diff --git a/sapi/fpm/fpm/zlog.c b/sapi/fpm/fpm/zlog.c
index 1659c77efc..4884dca856 100644
--- a/sapi/fpm/fpm/zlog.c
+++ b/sapi/fpm/fpm/zlog.c
@@ -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);
}
}
/* }}} */
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index a62b409072..148e18a454 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -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;
}
diff --git a/sapi/phpdbg/phpdbg.h b/sapi/phpdbg/phpdbg.h
index 94c5471e22..3df2be0aed 100644
--- a/sapi/phpdbg/phpdbg.h
+++ b/sapi/phpdbg/phpdbg.h
@@ -113,8 +113,6 @@
#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
diff --git a/sapi/phpdbg/phpdbg_io.c b/sapi/phpdbg/phpdbg_io.c
index b2f4ba7c0d..65a14d0ccb 100644
--- a/sapi/phpdbg/phpdbg_io.c
+++ b/sapi/phpdbg/phpdbg_io.c
@@ -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;
}
diff --git a/sapi/phpdbg/phpdbg_sigsafe.c b/sapi/phpdbg/phpdbg_sigsafe.c
index 2f987b3a15..081d864c5c 100644
--- a/sapi/phpdbg/phpdbg_sigsafe.c
+++ b/sapi/phpdbg/phpdbg_sigsafe.c
@@ -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;
}