summaryrefslogtreecommitdiffstats
path: root/libutils/FileMap.cpp
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@google.com>2014-10-16 10:14:58 -0700
committerXavier Ducrohet <xav@google.com>2014-10-16 12:09:06 -0700
commit1a55aa5e34f201b060da9a84ec9702401f05be18 (patch)
tree11b4565a82e68c903b929795afe367f33a0b3057 /libutils/FileMap.cpp
parent67f46cb0e137edbf4a6f7014ca8a3a58484016d1 (diff)
downloadsystem_core-1a55aa5e34f201b060da9a84ec9702401f05be18.zip
system_core-1a55aa5e34f201b060da9a84ec9702401f05be18.tar.gz
system_core-1a55aa5e34f201b060da9a84ec9702401f05be18.tar.bz2
Fix windows specific behavior of FileMap
The implementation of the FileMap destructor would close the file, only on Windows, which did not match the behavior on mac/linux. This is because calling munmap does not close the file descriptor. It must be closed separately, before or after munmap. On Windows, the file must also be closed manually, before or after closing the mappingFile. The change basically removes the closing file from the windows-specific part of the destructor, to make behavior more consistent on all platforms where the caller to FileMap is responsible for closing its own file (since FileMap receives an opened file). Change-Id: I5e3cfffbb870d5f3595802ccac57dbc1dbf1ce6e
Diffstat (limited to 'libutils/FileMap.cpp')
-rw-r--r--libutils/FileMap.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/libutils/FileMap.cpp b/libutils/FileMap.cpp
index be4b14f..f8d6bda 100644
--- a/libutils/FileMap.cpp
+++ b/libutils/FileMap.cpp
@@ -77,7 +77,6 @@ FileMap::~FileMap(void)
if (mFileMapping != INVALID_HANDLE_VALUE) {
CloseHandle(mFileMapping);
}
- CloseHandle(mFileHandle);
#endif
}