summaryrefslogtreecommitdiff
path: root/mmap
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2002-02-21 00:01:15 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2002-02-21 00:01:15 +0000
commit8df5ba2299a6a04e7df8fbdc755148eae5a72117 (patch)
tree22e0137b4d82e17d0e38f23e52c3f593fe7a6c35 /mmap
parent8ede7c81d5fc6b34dab96a7f4798b125d0d61c94 (diff)
downloadlibapr-8df5ba2299a6a04e7df8fbdc755148eae5a72117.tar.gz
Fix a Win32 segfault in mod_ssl, since ssl used file bucket to mmap
transformation to process input. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63038 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'mmap')
-rw-r--r--mmap/win32/mmap.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/mmap/win32/mmap.c b/mmap/win32/mmap.c
index a410390b7..9c0b0a74c 100644
--- a/mmap/win32/mmap.c
+++ b/mmap/win32/mmap.c
@@ -130,24 +130,23 @@ APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **new, apr_file_t *file,
*new = apr_pcalloc(cont, sizeof(apr_mmap_t));
(*new)->pstart = (offset / memblock) * memblock;
- (*new)->psize = (apr_size_t)(offset % memblock) + size;
(*new)->poffset = offset - (*new)->pstart;
- /* XXX: psize below should be the MAXIMUM size of the mmap object,
- * (e.g. file size) not the size of the mapped region!
- * Since apr doesn't seem to acknowledge the discrepancy (the mmap
- * size/view/off concepts are pretty horked) this will have to wait.
+ (*new)->psize = (apr_size_t)((*new)->poffset) + size;
+ /* The size of the CreateFileMapping object is the current size
+ * of the size of the mmap object (e.g. file size), not the size
+ * of the mapped region!
*/
(*new)->mhandle = CreateFileMapping(file->filehand, NULL, fmaccess,
- 0, (*new)->psize, NULL);
+ 0, 0, NULL);
if (!(*new)->mhandle || (*new)->mhandle == INVALID_HANDLE_VALUE)
{
*new = NULL;
return apr_get_os_error();
}
- offlo = (DWORD)(*new)->poffset;
- offhi = (DWORD)((*new)->poffset << 32);
+ offlo = (DWORD)(*new)->pstart;
+ offhi = (DWORD)((*new)->pstart >> 32);
(*new)->mv = MapViewOfFile((*new)->mhandle, mvaccess, offhi,
offlo, (*new)->psize);
if (!(*new)->mv)
@@ -158,7 +157,7 @@ APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **new, apr_file_t *file,
return rv;
}
- (*new)->mm = (char*)((*new)->mv) + offset;
+ (*new)->mm = (char*)((*new)->mv) + (*new)->poffset;
(*new)->size = size;
(*new)->cntxt = cont;
(*new)->is_owner = 1;