af9dc8
From 58c6a08e00d4a8c99123cfb36f3a399a9b352d24 Mon Sep 17 00:00:00 2001
af9dc8
From: Remi Collet <remi@php.net>
af9dc8
Date: Tue, 10 Jun 2014 10:28:34 +0200
af9dc8
Subject: [PATCH] Fixed bug #67406 built-in web-server segfaults on startup
af9dc8
af9dc8
Reproduce on aarch64.
af9dc8
af9dc8
From select man page:
af9dc8
  "select() may update the timeout argument to indicate how much time was left."
af9dc8
So "const" is not ok.
af9dc8
---
af9dc8
 sapi/cli/php_cli_server.c | 6 +++---
af9dc8
 1 file changed, 3 insertions(+), 3 deletions(-)
af9dc8
af9dc8
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
af9dc8
index e838d30..3fd24ea 100644
af9dc8
--- a/sapi/cli/php_cli_server.c
af9dc8
+++ b/sapi/cli/php_cli_server.c
af9dc8
@@ -768,11 +768,11 @@ static void php_cli_server_poller_remove(php_cli_server_poller *poller, int mode
af9dc8
 #endif
af9dc8
 } /* }}} */
af9dc8
 
af9dc8
-static int php_cli_server_poller_poll(php_cli_server_poller *poller, const struct timeval *tv) /* {{{ */
af9dc8
+static int php_cli_server_poller_poll(php_cli_server_poller *poller, struct timeval *tv) /* {{{ */
af9dc8
 {
af9dc8
 	memmove(&poller->active.rfds, &poller->rfds, sizeof(poller->rfds));
af9dc8
 	memmove(&poller->active.wfds, &poller->wfds, sizeof(poller->wfds));
af9dc8
-	return php_select(poller->max_fd + 1, &poller->active.rfds, &poller->active.wfds, NULL, (struct timeval *)tv);
af9dc8
+	return php_select(poller->max_fd + 1, &poller->active.rfds, &poller->active.wfds, NULL, tv);
af9dc8
 } /* }}} */
af9dc8
 
af9dc8
 static int php_cli_server_poller_iter_on_active(php_cli_server_poller *poller, void *opaque, int(*callback)(void *, int fd, int events)) /* {{{ */
af9dc8
@@ -2349,7 +2349,7 @@ static int php_cli_server_do_event_loop(php_cli_server *server TSRMLS_DC) /* {{{
af9dc8
 {
af9dc8
 	int retval = SUCCESS;
af9dc8
 	while (server->is_running) {
af9dc8
-		static const struct timeval tv = { 1, 0 };
af9dc8
+		struct timeval tv = { 1, 0 };
af9dc8
 		int n = php_cli_server_poller_poll(&server->poller, &tv;;
af9dc8
 		if (n > 0) {
af9dc8
 			php_cli_server_do_event_for_each_fd(server,
af9dc8
-- 
af9dc8
1.9.2
af9dc8