Advertisement
Guest User

Untitled

a guest
Jan 30th, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.58 KB | None | 0 0
  1. Index: ext/standard/streamsfuncs.c
  2. ===================================================================
  3. --- ext/standard/streamsfuncs.c (revision 322532)
  4. +++ ext/standard/streamsfuncs.c (working copy)
  5. @@ -30,6 +30,7 @@
  6.  #include "streamsfuncs.h"
  7.  #include "php_network.h"
  8.  #include "php_string.h"
  9. +#include "ext/sockets/php_sockets.h"
  10.  
  11.  #ifndef PHP_WIN32
  12.  #define php_select(m, r, w, e, t)  select(m, r, w, e, t)
  13. @@ -252,6 +253,7 @@
  14.     php_stream *stream = NULL, *clistream = NULL;
  15.     zval *zstream;
  16.  
  17. +   int error_code = 0;
  18.     char *errstr = NULL;
  19.  
  20.     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|dz", &zstream, &timeout, &zpeername) == FAILURE) {
  21. @@ -278,7 +280,7 @@
  22.                 zpeername ? &peername : NULL,
  23.                 zpeername ? &peername_len : NULL,
  24.                 NULL, NULL,
  25. -               &tv, &errstr
  26. +               &tv, &error_code, &errstr
  27.                 TSRMLS_CC) && clistream) {
  28.  
  29.         if (peername) {
  30. @@ -287,6 +289,7 @@
  31.         php_stream_to_zval(clistream, return_value);
  32.     } else {
  33.         php_error_docref(NULL TSRMLS_CC, E_WARNING, "accept failed: %s", errstr ? errstr : "Unknown error");
  34. +       SOCKETS_G(last_error) = error_code;
  35.         RETVAL_FALSE;
  36.     }
  37.  
  38. Index: ext/sockets/php_sockets.h
  39. ===================================================================
  40. --- ext/sockets/php_sockets.h   (revision 322532)
  41. +++ ext/sockets/php_sockets.h   (working copy)
  42. @@ -112,6 +112,9 @@
  43.     char *strerror_buf;
  44.  ZEND_END_MODULE_GLOBALS(sockets)
  45.  
  46. +extern ZEND_DECLARE_MODULE_GLOBALS(sockets)
  47. +
  48. +
  49.  #ifdef ZTS
  50.  #define SOCKETS_G(v) TSRMG(sockets_globals_id, zend_sockets_globals *, v)
  51.  #else
  52. Index: main/streams/transports.c
  53. ===================================================================
  54. --- main/streams/transports.c   (revision 322532)
  55. +++ main/streams/transports.c   (working copy)
  56. @@ -285,6 +285,7 @@
  57.         char **textaddr, int *textaddrlen,
  58.         void **addr, socklen_t *addrlen,
  59.         struct timeval *timeout,
  60. +       int *error_code,
  61.         char **error_text
  62.         TSRMLS_DC)
  63.  {
  64. @@ -311,6 +312,9 @@
  65.             *textaddr = param.outputs.textaddr;
  66.             *textaddrlen = param.outputs.textaddrlen;
  67.         }
  68. +       if (error_code) {
  69. +           *error_code = param.outputs.error_code;
  70. +       }
  71.         if (error_text) {
  72.             *error_text = param.outputs.error_text;
  73.         }
  74. Index: main/streams/php_stream_transport.h
  75. ===================================================================
  76. --- main/streams/php_stream_transport.h (revision 322532)
  77. +++ main/streams/php_stream_transport.h (working copy)
  78. @@ -84,6 +84,7 @@
  79.         char **textaddr, int *textaddrlen,
  80.         void **addr, socklen_t *addrlen,
  81.         struct timeval *timeout,
  82. +       int *error_code,
  83.         char **error_text
  84.         TSRMLS_DC);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement