Bug #9347 Updated: php_read does not handle O_NONBLOCK correctly
| From: | sniper@php.net | Date: | Tue, 12 Jun 2001 05:08:40 +0000 |
| Subject: | Bug #9347 Updated: php_read does not handle O_NONBLOCK correctly | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-57215@lists.php.net to get a copy of this message | ||
ID: 9347
Updated by: sniper
Reported By: tem@iocus.com
Old-Status: Open
Status: Closed
Bug Type: Sockets related
Operating system:
PHP Version: 4.0 Latest CVS (19/02/2001)
Assigned To:
Comments:
This is not correct. The php_read() will loop until
it get's some data in case of EAGAIN.
(at least in latest CVS)
--Jani
Previous Comments:
---------------------------------------------------------------------------
[2001-02-19 17:37:18] tem@iocus.com
err did the patch backwards.
--- ext/sockets/sockets.c Mon Feb 19 16:52:42 2001
+++ ext/sockets/mysocket.c Mon Feb 19 16:53:20 2001
@@ -635,7 +635,7 @@
if (m > 0) {
t++;
n++;
- } else if (m == 0) {
+ } else if (m <= 0) {
no_read++;
if (nonblock && no_read >= 2) {
return n; /* The first pass, m always is 0, so no_read becomes 1
---------------------------------------------------------------------------
[2001-02-19 17:11:44] tem@iocus.com
The php_read function does not seem to handle non-blocking sockets correctly. The read function
will return a negative value when EAGAIN (no data available when in nonblocking mode) error occurs.
(from the man page:
On error, -1 is returned, and errno is set appropriately.) Here is my quick n' dirty patch:
--- ext/sockets/mysocket.c Mon Feb 19 16:53:20 2001
+++ ext/sockets/sockets.c Mon Feb 19 16:52:42 2001
@@ -635,7 +635,7 @@
if (m > 0) {
t++;
n++;
- } else if (m <= 0) {
+ } else if (m == 0) {
no_read++;
if (nonblock && no_read >= 2) {
return n; /* The first pass, m always is 0, so no_read becomes 1
enjoy.
-tem
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=9347&edit=2