Skip to content

Commit

Permalink
Fixed bug #67406 built-in web-server segfaults on startup
Browse files Browse the repository at this point in the history
Reproduce on aarch64.

From select man page:
  "select() may update the timeout argument to indicate how much time was left."
So "const" is not ok.
  • Loading branch information
remicollet committed Jun 10, 2014
1 parent 6285799 commit 58c6a08
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sapi/cli/php_cli_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,11 +768,11 @@ static void php_cli_server_poller_remove(php_cli_server_poller *poller, int mode
#endif
} /* }}} */

static int php_cli_server_poller_poll(php_cli_server_poller *poller, const struct timeval *tv) /* {{{ */
static int php_cli_server_poller_poll(php_cli_server_poller *poller, struct timeval *tv) /* {{{ */
{
memmove(&poller->active.rfds, &poller->rfds, sizeof(poller->rfds));
memmove(&poller->active.wfds, &poller->wfds, sizeof(poller->wfds));
return php_select(poller->max_fd + 1, &poller->active.rfds, &poller->active.wfds, NULL, (struct timeval *)tv);
return php_select(poller->max_fd + 1, &poller->active.rfds, &poller->active.wfds, NULL, tv);
} /* }}} */

static int php_cli_server_poller_iter_on_active(php_cli_server_poller *poller, void *opaque, int(*callback)(void *, int fd, int events)) /* {{{ */
Expand Down Expand Up @@ -2349,7 +2349,7 @@ static int php_cli_server_do_event_loop(php_cli_server *server TSRMLS_DC) /* {{{
{
int retval = SUCCESS;
while (server->is_running) {
static const struct timeval tv = { 1, 0 };
struct timeval tv = { 1, 0 };
int n = php_cli_server_poller_poll(&server->poller, &tv);
if (n > 0) {
php_cli_server_do_event_for_each_fd(server,
Expand Down

0 comments on commit 58c6a08

Please sign in to comment.