bjh 99/11/03 04:47:24
Modified: src/lib/apr/file_io/os2 readwrite.c
src/main http_protocol.c
Log:
OS/2: Don't return APR_EOF from ap_read(). EOF is indicated by a APR_SUCCESS
status with nbytes set to 0.
Revision Changes Path
1.6 +10 -15 apache-2.0/src/lib/apr/file_io/os2/readwrite.c
Index: readwrite.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/readwrite.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- readwrite.c 1999/10/19 15:24:19 1.5
+++ readwrite.c 1999/11/03 12:47:22 1.6
@@ -85,8 +85,11 @@
while (rc == 0 && size > 0) {
if (thefile->bufpos >= thefile->dataRead) {
rc = DosRead(thefile->filedes, thefile->buffer,
APR_FILE_BUFSIZE, &thefile->dataRead );
- if (thefile->dataRead == 0)
+ if (thefile->dataRead == 0) {
+ if (rc == 0)
+ thefile->eof_hit = TRUE;
break;
+ }
thefile->filePtr += thefile->dataRead;
thefile->bufpos = 0;
}
@@ -99,15 +102,6 @@
}
*nbytes = rc == 0 ? pos - (char *)buf : 0;
-
- // if an error occurred report it
- // if we read some data but hit EOF before reading 'size' bytes,
return Ok (0)
- // if we hit EOF with no data read, return -1
- if (size && rc == 0 && pos == (char *)buf) {
- thefile->eof_hit = TRUE;
- *_errno() = APR_EOF;
- return APR_EOF;
- }
return os2errno(rc);
} else {
rc = DosRead(thefile->filedes, buf, *nbytes, &bytesread);
@@ -307,15 +301,16 @@
ap_status_t ap_fgets(char *str, int len, ap_file_t *thefile)
{
ssize_t readlen;
- ap_status_t rv;
+ ap_status_t rv = APR_SUCCESS;
int i;
for (i = 0; i < len-1; i++) {
readlen = 1;
rv = ap_read(thefile, str+i, &readlen);
-
- if (rv != APR_SUCCESS) {
- return rv;
+
+ if (readlen != 1) {
+ rv = APR_EOF;
+ break;
}
if (str[i] == '\r')
@@ -324,7 +319,7 @@
break;
}
str[i] = 0;
- return APR_SUCCESS;
+ return rv;
}
1.35 +1 -1 apache-2.0/src/main/http_protocol.c
Index: http_protocol.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- http_protocol.c 1999/11/02 14:34:32 1.34
+++ http_protocol.c 1999/11/03 12:47:23 1.35
@@ -2111,7 +2111,7 @@
while (!ap_is_aborted(r->connection)) {
rv = ap_bread(fb, buf, sizeof(buf), &n);
if (n == 0) {
- if (rv == APR_SUCCESS || rv == APR_EOF) { /* eof */
+ if (rv == APR_SUCCESS) { /* eof */
(void) ap_rflush(r);
break;
}