iliaa           Sun Dec  4 12:31:41 2005 EDT

  Modified files:              
    /php-src/ext/sockets        sockets.c 
  Log:
  MFB51: Fixed bug #35062 (socket_read() produces warnings on non blocking 
  sockets).
  
  
http://cvs.php.net/diff.php/php-src/ext/sockets/sockets.c?r1=1.174&r2=1.175&ty=u
Index: php-src/ext/sockets/sockets.c
diff -u php-src/ext/sockets/sockets.c:1.174 php-src/ext/sockets/sockets.c:1.175
--- php-src/ext/sockets/sockets.c:1.174 Sat Dec  3 18:24:07 2005
+++ php-src/ext/sockets/sockets.c       Sun Dec  4 12:31:40 2005
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: sockets.c,v 1.174 2005/12/03 23:24:07 tony2001 Exp $ */
+/* $Id: sockets.c,v 1.175 2005/12/04 17:31:40 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -859,7 +859,19 @@
        }
 
        if (retval == -1) {
-               PHP_SOCKET_ERROR(php_sock, "unable to read from socket", errno);
+               /* if the socket is in non-blocking mode and there's no data to 
read,
+               don't output any error, as this is a normal situation, and not 
an error */
+               if (errno == EAGAIN
+#ifdef EWOULDBLOCK
+               || errno == EWOULDBLOCK
+#endif
+               ) {
+                       php_sock->error = errno;
+                       SOCKETS_G(last_error) = errno;
+               } else {
+                       PHP_SOCKET_ERROR(php_sock, "unable to read from 
socket", errno);
+               }
+
                efree(tmpbuf);
                RETURN_FALSE;
        }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to