summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo André dos Santos Lopes <cataphract@php.net>2011-03-23 00:51:22 +0000
committerGustavo André dos Santos Lopes <cataphract@php.net>2011-03-23 00:51:22 +0000
commit660aa6701d1b32e64e8b6c40603b18b92d4806c4 (patch)
tree2730c2e71e5f9419a8f4fa21276b711592bdb440
parent0dd448cbf19fade5aadb0c41f922e5901dd628ec (diff)
downloadphp-git-660aa6701d1b32e64e8b6c40603b18b92d4806c4.tar.gz
- Updating UPGRADING for r309516 and modest merge to 5.3.
-rw-r--r--NEWS2
-rw-r--r--ext/sockets/sockets.c8
-rw-r--r--ext/sockets/tests/socket_strerror.phpt2
-rw-r--r--main/network.c4
4 files changed, 12 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index e3e7f7d543..5c67a49096 100644
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,8 @@ PHP NEWS
. Fixed bug #54312 (soap_version logic bug). (tom at samplonius dot org)
- Sockets extension:
+ . Changed socket_set_block() and socket_set_nonblock() so they emit warnings
+ on error. (Gustavo)
. Fixed bug #51958 (socket_accept() fails on IPv6 server sockets). (Gustavo)
- SPL extension:
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index 7b3c54ff88..91ae979827 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -916,8 +916,10 @@ PHP_FUNCTION(socket_set_nonblock)
if (php_set_sock_blocking(php_sock->bsd_socket, 0 TSRMLS_CC) == SUCCESS) {
php_sock->blocking = 0;
RETURN_TRUE;
+ } else {
+ PHP_SOCKET_ERROR(php_sock, "unable to set nonblocking mode", errno);
+ RETURN_FALSE;
}
- RETURN_FALSE;
}
/* }}} */
@@ -937,8 +939,10 @@ PHP_FUNCTION(socket_set_block)
if (php_set_sock_blocking(php_sock->bsd_socket, 1 TSRMLS_CC) == SUCCESS) {
php_sock->blocking = 1;
RETURN_TRUE;
+ } else {
+ PHP_SOCKET_ERROR(php_sock, "unable to set blocking mode", errno);
+ RETURN_FALSE;
}
- RETURN_FALSE;
}
/* }}} */
diff --git a/ext/sockets/tests/socket_strerror.phpt b/ext/sockets/tests/socket_strerror.phpt
index d1759c582c..d3abe8fb59 100644
--- a/ext/sockets/tests/socket_strerror.phpt
+++ b/ext/sockets/tests/socket_strerror.phpt
@@ -154,4 +154,4 @@ string(20) "Key has been revoked"
string(27) "Key was rejected by service"
string(10) "Owner died"
string(21) "State not recoverable"
-string(17) "Unknown error 132"
+string(37) "Operation not possible due to RF-kill"
diff --git a/main/network.c b/main/network.c
index 1133fc5901..770a6d8252 100644
--- a/main/network.c
+++ b/main/network.c
@@ -1095,7 +1095,9 @@ PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC)
} else {
flags &= ~myflag;
}
- fcntl(socketd, F_SETFL, flags);
+ if (fcntl(socketd, F_SETFL, flags) == -1) {
+ ret = FAILURE;
+ }
#endif
return ret;
}