You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/09/04 15:09:02 UTC
svn commit: r811379 -
/commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c
Author: mturk
Date: Fri Sep 4 13:09:02 2009
New Revision: 811379
URL: http://svn.apache.org/viewvc?rev=811379&view=rev
Log:
Return ERROR if a call returns FALSE
Modified:
commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c?rev=811379&r1=811378&r2=811379&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c Fri Sep 4 13:09:02 2009
@@ -62,16 +62,16 @@
if (type != ACR_DT_MMAP) {
return ACR_EFTYPE;
}
- if (IS_VALID_HANDLE(m->base)) {
+ if (IS_VALID_MEMORY(m->base)) {
if (!UnmapViewOfFile(m->base))
rc = ACR_GET_OS_ERROR();
}
- if (CloseHandle(m->mh))
+ if (!CloseHandle(m->mh))
rc = ACR_GET_OS_ERROR();
- if (flags == MMAP_OWNS_FILE) {
+ if ((flags & MMAP_OWNS_FILE)) {
/* Since we have opended the file close it.
*/
- if (CloseHandle(m->fd))
+ if (!CloseHandle(m->fd))
rc = ACR_GET_OS_ERROR();
}
free(m);
@@ -80,7 +80,7 @@
static int mmap_pointer_cleanup(void *address, size_t length)
{
- if (!length || IS_INVALID_HANDLE(address))
+ if (!length || IS_INVALID_MEMORY(address))
return ACR_EBADF;
if (!UnmapViewOfFile(address))
return ACR_GET_OS_ERROR();
@@ -108,7 +108,7 @@
if (ACR_IOH_FTYPE(dp->di) != ACR_DT_MMAP)
rc = ACR_EFTYPE;
else {
- if (IS_VALID_HANDLE(m->base)) {
+ if (IS_VALID_MEMORY(m->base)) {
if (!FlushViewOfFile(m->base, m->size)) {
/* Error during flushing.
*/