From 1a55aa5e34f201b060da9a84ec9702401f05be18 Mon Sep 17 00:00:00 2001 From: Xavier Ducrohet Date: Thu, 16 Oct 2014 10:14:58 -0700 Subject: [PATCH] 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 --- libutils/FileMap.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libutils/FileMap.cpp b/libutils/FileMap.cpp index be4b14fed..f8d6bdabd 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 }