You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by st...@hyperreal.org on 2000/02/01 01:40:47 UTC
cvs commit: apache-2.0/src/lib/apr/file_io/win32 readwrite.c
stoddard 00/01/31 16:40:45
Modified: src/lib/apr/file_io/win32 readwrite.c
Log:
Return correct error status.
Revision Changes Path
1.10 +10 -10 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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- readwrite.c 1999/12/09 21:00:10 1.9
+++ readwrite.c 2000/02/01 00:40:40 1.10
@@ -86,7 +86,7 @@
}
*nbytes = -1;
- return APR_EEXIST;
+ return lasterror;
}
ap_status_t ap_write(struct file_t *thefile, void *buf, ap_ssize_t *nbytes)
@@ -112,7 +112,7 @@
return APR_SUCCESS;
}
(*nbytes) = -1;
- return APR_EEXIST;
+ return GetLastError();
}
/*
* Too bad WriteFileGather() is not supported on 95&98 (or NT prior to SP2)
@@ -127,7 +127,7 @@
for (i = 0; i < numvec; i++) {
if (!WriteFile(thefile->filehand,
vec->iov[i].iov_base, vec->iov[i].iov_len, &bwrote, NULL)) {
- return GetLastError(); /* TODO: Yes, I know this is broken... */
+ return GetLastError();
}
*iocnt += bwrote;
}
@@ -139,7 +139,7 @@
DWORD bwrote;
if (!WriteFile(thefile->filehand, &ch, 1, &bwrote, NULL)) {
- return APR_EEXIST;
+ return GetLastError();
}
return APR_SUCCESS;
}
@@ -162,17 +162,17 @@
/* SetFilePointer is only valid for a file device ...*/
if (GetFileType(thefile->filehand) != FILE_TYPE_DISK) {
- return !APR_SUCCESS; /* is there no generic failure code? */
+ return GetLastError();
}
/* that's buffered... */
if (!thefile->buffered) {
- return !APR_SUCCESS; /* is there no generic failure code? */
+ return GetLastError();
}
/* and the file pointer is not pointing to the start of the file. */
if (GetFilePointer(thefile->filehand)) {
if (SetFilePointer(thefile->filehand, -1, NULL, FILE_CURRENT)
== 0xFFFFFFFF) {
- return !APR_SUCCESS;
+ return GetLastError();
}
}
@@ -184,7 +184,7 @@
{
DWORD bread;
if (!ReadFile(thefile->filehand, ch, 1, &bread, NULL)) {
- return APR_EEXIST;
+ return GetLastError();
}
if (bread == 0) {
thefile->eof_hit = TRUE;
@@ -202,7 +202,7 @@
str[len] = '\n';
if (!WriteFile(thefile->filehand, str, len+1, &bwrote, NULL)) {
str[len] = '\0';
- return APR_EEXIST;
+ return GetLastError();
}
str[len] = '\0';
@@ -218,7 +218,7 @@
case ERROR_HANDLE_EOF:
return APR_EOF;
default:
- return APR_EEXIST;
+ return GetLastError();
}
}
if (bread == 0) {