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