diff options
author | krakjoe <joe.watkins@live.co.uk> | 2014-11-25 08:37:02 +0000 |
---|---|---|
committer | krakjoe <joe.watkins@live.co.uk> | 2014-11-25 08:37:02 +0000 |
commit | e07feeaf8b91f16a89e9903b461042a0f6a63ac0 (patch) | |
tree | 4a94cd382fcffefff920f7733562e1860a66cc44 /sapi/cli | |
parent | 9b6836ebd36eccc9e81ca51e2efe172e1d334f0b (diff) | |
parent | d4f42289ddde002cb4d3ed9d1a4f2219f68df48e (diff) | |
download | php-git-e07feeaf8b91f16a89e9903b461042a0f6a63ac0.tar.gz |
Merge branch 'master' of https://github.com/php/php-src
Diffstat (limited to 'sapi/cli')
-rw-r--r-- | sapi/cli/php_cli_server.c | 11 | ||||
-rw-r--r-- | sapi/cli/php_http_parser.c | 2 | ||||
-rw-r--r-- | sapi/cli/ps_title.c | 4 |
3 files changed, 10 insertions, 7 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 19a94218ff..49680cede4 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -259,7 +259,9 @@ static php_cli_server_http_response_status_code_pair template_map[] = { { 501, "<h1>%s</h1><p>Request method not supported.</p>" } }; +#if HAVE_UNISTD_H static int php_cli_output_is_tty = OUTPUT_NOT_CHECKED; +#endif static size_t php_cli_server_client_send_through(php_cli_server_client *client, const char *str, size_t str_len); static php_cli_server_chunk *php_cli_server_chunk_heap_new_self_contained(size_t len); @@ -556,7 +558,7 @@ static void sapi_cli_server_flush(void *server_context TSRMLS_DC) /* {{{ */ return; } - if (client->sock < 0) { + if (!ZEND_VALID_SOCKET(client->sock)) { php_handle_aborted_connection(); return; } @@ -838,7 +840,6 @@ static int php_cli_server_poller_iter_on_active(php_cli_server_poller *poller, v SOCKET fd; int events; } entries[FD_SETSIZE * 2]; - php_socket_t fd = 0; size_t i; struct socket_entry *n = entries, *m; @@ -1338,7 +1339,7 @@ out: php_network_freeaddresses(sal); } if (err) { - if (retval >= 0) { + if (ZEND_VALID_SOCKET(retval)) { closesocket(retval); } if (errstr) { @@ -2186,7 +2187,7 @@ static void php_cli_server_dtor(php_cli_server *server TSRMLS_DC) /* {{{ */ { zend_hash_destroy(&server->clients); zend_hash_destroy(&server->extension_mime_types); - if (server->server_sock >= 0) { + if (ZEND_VALID_SOCKET(server->server_sock)) { closesocket(server->server_sock); } if (server->host) { @@ -2407,7 +2408,7 @@ static int php_cli_server_do_event_for_each_fd_callback(void *_params, php_socke return FAILURE; } client_sock = accept(server->server_sock, sa, &socklen); - if (client_sock < 0) { + if (!ZEND_VALID_SOCKET(client_sock)) { char *errstr; errstr = php_socket_strerror(php_socket_errno(), NULL, 0); php_cli_server_logf("Failed to accept a client (reason: %s)" TSRMLS_CC, errstr); diff --git a/sapi/cli/php_http_parser.c b/sapi/cli/php_http_parser.c index cc649af79a..31ae4167d1 100644 --- a/sapi/cli/php_http_parser.c +++ b/sapi/cli/php_http_parser.c @@ -1378,7 +1378,7 @@ size_t php_http_parser_execute (php_http_parser *parser, /* Here we call the headers_complete callback. This is somewhat * different than other callbacks because if the user returns 1, we * will interpret that as saying that this message has no body. This - * is needed for the annoying case of recieving a response to a HEAD + * is needed for the annoying case of receiving a response to a HEAD * request. */ if (settings->on_headers_complete) { diff --git a/sapi/cli/ps_title.c b/sapi/cli/ps_title.c index 97eec86e5b..6cef483983 100644 --- a/sapi/cli/ps_title.c +++ b/sapi/cli/ps_title.c @@ -129,7 +129,9 @@ static char** save_argv; * This holds the 'locally' allocated environ from the save_ps_args method. * This is subsequently free'd at exit. */ +#if defined(PS_USE_CLOBBER_ARGV) static char** frozen_environ, **new_environ; +#endif /* * Call this method early, before any code has used the original argv passed in @@ -311,7 +313,7 @@ const char* ps_title_errno(int rc) #ifdef PS_USE_WIN32 case PS_TITLE_WINDOWS_ERROR: - sprintf(windows_error_details, "Windows error code: %u", GetLastError()); + sprintf(windows_error_details, "Windows error code: %lu", GetLastError()); return windows_error_details; #endif } |