diff options
| author | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2006-03-23 19:36:25 +0000 |
|---|---|---|
| committer | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2006-03-23 19:36:25 +0000 |
| commit | ba46b063b62d576b127922db3fdbc21a4e5545da (patch) | |
| tree | 072907ba123cd21509c758eadd9263342a26f933 | |
| parent | 480ae66aeff1251a718c17fb22fe8089fec6e1cd (diff) | |
| download | libapr-ba46b063b62d576b127922db3fdbc21a4e5545da.tar.gz | |
The original value before seek() certainly could be at the upper bounds
of 2^32-1. Protect against this by trusting the error result.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@388241 13f79535-47bb-0310-9956-ffa450edef68
| -rw-r--r-- | file_io/win32/seek.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/file_io/win32/seek.c b/file_io/win32/seek.c index 9148181a4..e4e3608d6 100644 --- a/file_io/win32/seek.c +++ b/file_io/win32/seek.c @@ -48,9 +48,16 @@ static apr_status_t setptr(apr_file_t *thefile, apr_off_t pos ) DWORD offhi = (DWORD)(pos >> 32); rc = SetFilePointer(thefile->filehand, offlo, &offhi, FILE_BEGIN); - if (rc == 0xFFFFFFFF) + if (rc == INVALID_SET_FILE_POINTER) + /* A legal value, perhaps? MSDN implies prior SetLastError isn't + * needed, googling for SetLastError SetFilePointer seems + * to confirm this. + */ rv = apr_get_os_error(); - else { + else + rv = APR_SUCCESS; + + if (rv == APR_SUCCESS) { rv = APR_SUCCESS; thefile->eof_hit = 0; thefile->bufpos = thefile->dataRead = 0; |
