rbb 00/02/14 05:43:39
Modified: src/lib/apr/network_io/unix sendrecv.c Log: Fix some bugs in ap_send and ap_recv. We used to return APR_SUCCESS even when it didn't succeed. The other problem this is solving, is that we never set the length to -1 anymore. The length is the number of bytes written or read, as such -1 makes no sense. If there is an error, 0 bytes were written, so len should be 0. Submitted by: Manoj Kasichainula and Ryan Bloom Revision Changes Path 1.10 +10 -2 apache-2.0/src/lib/apr/network_io/unix/sendrecv.c Index: sendrecv.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sendrecv.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- sendrecv.c 2000/01/26 05:01:16 1.9 +++ sendrecv.c 2000/02/14 13:43:39 1.10 @@ -108,17 +108,21 @@ } while (srv == -1 && errno == EINTR); if (srv == 0) { - (*len) = -1; + (*len) = 0; return APR_TIMEUP; } else if (srv < 0) { - (*len) = -1; + (*len) = 0; return errno; } else { do { rv = write(sock->socketdes, buf, (*len)); } while (rv == -1 && errno == EINTR); + if (rv == -1) { + (*len) = 0; + return errno; + } } } (*len) = rv; @@ -175,6 +179,10 @@ do { rv = read(sock->socketdes, buf, (*len)); } while (rv == -1 && errno == EINTR); + if (rv == -1) { + (*len) = 0; + return errno; + } } } else if (rv == -1 && errno == EAGAIN && sock->timeout == 0) {