summaryrefslogtreecommitdiff
path: root/sapi/cli
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-11-10 18:16:31 +0100
committerAnatol Belski <ab@php.net>2014-11-10 23:30:12 +0100
commit88ba5a625c7efb1001ce90c8f4649cff830d82a4 (patch)
tree8ed76e039e23aa568d5e6b19c8f318d2f2802c1b /sapi/cli
parent09aa419d13204ffd1b4a705b8f04d6d25fc19556 (diff)
downloadphp-git-88ba5a625c7efb1001ce90c8f4649cff830d82a4.tar.gz
do portable socket checks
also introduced a portable macro for that
Diffstat (limited to 'sapi/cli')
-rw-r--r--sapi/cli/php_cli_server.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 19a94218ff..20e27f0bb7 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -556,7 +556,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;
}
@@ -1338,7 +1338,7 @@ out:
php_network_freeaddresses(sal);
}
if (err) {
- if (retval >= 0) {
+ if (ZEND_VALID_SOCKET(retval)) {
closesocket(retval);
}
if (errstr) {
@@ -2186,7 +2186,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 +2407,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);