Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: ext/standard/streamsfuncs.c
- ===================================================================
- --- ext/standard/streamsfuncs.c (revision 322532)
- +++ ext/standard/streamsfuncs.c (working copy)
- @@ -30,6 +30,7 @@
- #include "streamsfuncs.h"
- #include "php_network.h"
- #include "php_string.h"
- +#include "ext/sockets/php_sockets.h"
- #ifndef PHP_WIN32
- #define php_select(m, r, w, e, t) select(m, r, w, e, t)
- @@ -252,6 +253,7 @@
- php_stream *stream = NULL, *clistream = NULL;
- zval *zstream;
- + int error_code = 0;
- char *errstr = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|dz", &zstream, &timeout, &zpeername) == FAILURE) {
- @@ -278,7 +280,7 @@
- zpeername ? &peername : NULL,
- zpeername ? &peername_len : NULL,
- NULL, NULL,
- - &tv, &errstr
- + &tv, &error_code, &errstr
- TSRMLS_CC) && clistream) {
- if (peername) {
- @@ -287,6 +289,7 @@
- php_stream_to_zval(clistream, return_value);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "accept failed: %s", errstr ? errstr : "Unknown error");
- + SOCKETS_G(last_error) = error_code;
- RETVAL_FALSE;
- }
- Index: ext/sockets/php_sockets.h
- ===================================================================
- --- ext/sockets/php_sockets.h (revision 322532)
- +++ ext/sockets/php_sockets.h (working copy)
- @@ -112,6 +112,9 @@
- char *strerror_buf;
- ZEND_END_MODULE_GLOBALS(sockets)
- +extern ZEND_DECLARE_MODULE_GLOBALS(sockets)
- +
- +
- #ifdef ZTS
- #define SOCKETS_G(v) TSRMG(sockets_globals_id, zend_sockets_globals *, v)
- #else
- Index: main/streams/transports.c
- ===================================================================
- --- main/streams/transports.c (revision 322532)
- +++ main/streams/transports.c (working copy)
- @@ -285,6 +285,7 @@
- char **textaddr, int *textaddrlen,
- void **addr, socklen_t *addrlen,
- struct timeval *timeout,
- + int *error_code,
- char **error_text
- TSRMLS_DC)
- {
- @@ -311,6 +312,9 @@
- *textaddr = param.outputs.textaddr;
- *textaddrlen = param.outputs.textaddrlen;
- }
- + if (error_code) {
- + *error_code = param.outputs.error_code;
- + }
- if (error_text) {
- *error_text = param.outputs.error_text;
- }
- Index: main/streams/php_stream_transport.h
- ===================================================================
- --- main/streams/php_stream_transport.h (revision 322532)
- +++ main/streams/php_stream_transport.h (working copy)
- @@ -84,6 +84,7 @@
- char **textaddr, int *textaddrlen,
- void **addr, socklen_t *addrlen,
- struct timeval *timeout,
- + int *error_code,
- char **error_text
- TSRMLS_DC);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement