You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by gs...@locus.apache.org on 2000/11/07 02:27:16 UTC
cvs commit: apache-2.0/src/lib/apr/file_io/win32 readwrite.c
gstein 00/11/06 17:27:16
Modified: src/lib/apr/file_io/win32 readwrite.c
Log:
*) A successful call to ReadFile() with 0 bytes read indicates EOF. Return
APR_EOF as appropriate. This fixes the unbuffered branch of apr_read() to
ensure that apr_read() will eventually return APR_EOF. Compensate in the
buffered branch since read_with_timeout() now handles the APR_EOF return.
*) Initialize 'rv' before use in apr_write()
Submitted by: Branko Cibej <br...@xbc.nu>
Reviewed by: Greg Stein
Revision Changes Path
1.48 +7 -4 apache-2.0/src/lib/apr/file_io/win32/readwrite.c
Index: readwrite.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/readwrite.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- readwrite.c 2000/10/16 06:04:40 1.47
+++ readwrite.c 2000/11/07 01:27:14 1.48
@@ -139,7 +139,11 @@
rv = APR_SUCCESS; /* APR_EOF? */
}
} else {
- rv = APR_SUCCESS;
+ /* OK and 0 bytes read ==> end of file */
+ if (*nbytes == 0)
+ rv = APR_EOF;
+ else
+ rv = APR_SUCCESS;
}
return rv;
}
@@ -186,10 +190,8 @@
rv = read_with_timeout(thefile, thefile->buffer,
APR_FILE_BUFSIZE, &thefile->dataRead);
if (thefile->dataRead == 0) {
- if (rv == APR_SUCCESS) {
+ if (rv == APR_EOF)
thefile->eof_hit = TRUE;
- rv = APR_EOF;
- }
break;
}
@@ -240,6 +242,7 @@
thefile->direction = 1;
}
+ rv = 0;
while (rv == 0 && size > 0) {
if (thefile->bufpos == APR_FILE_BUFSIZE) // write buffer is full
rv = apr_flush(thefile);