projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix shutdown race between mono_thread_manage and mono_thread_detach_internal. (#5599)
[mono.git]
/
mono
/
metadata
/
file-mmap-windows.c
diff --git
a/mono/metadata/file-mmap-windows.c
b/mono/metadata/file-mmap-windows.c
index 1ecf2dedbe8299f8c78ff61ca1169fde19acfc8b..59abd6686ffe192285513af90cccac7c23becd7a 100644
(file)
--- a/
mono/metadata/file-mmap-windows.c
+++ b/
mono/metadata/file-mmap-windows.c
@@
-140,7
+140,7
@@
static void *open_handle (void *handle, MonoString *mapName, int mode, gint64 *c
HANDLE result = NULL;
if (handle == INVALID_HANDLE_VALUE) {
HANDLE result = NULL;
if (handle == INVALID_HANDLE_VALUE) {
- if (*capacity <= 0) {
+ if (*capacity <= 0
&& mode != FILE_MODE_OPEN
) {
*error = CAPACITY_MUST_BE_POSITIVE;
return NULL;
}
*error = CAPACITY_MUST_BE_POSITIVE;
return NULL;
}
@@
-271,6
+271,8
@@
void *mono_mmap_open_file (MonoString *path, int mode, MonoString *mapName, gint
result = open_handle (hFile, mapName, mode, capacity, access, options, error);
done:
result = open_handle (hFile, mapName, mode, capacity, access, options, error);
done:
+ if (hFile != INVALID_HANDLE_VALUE)
+ CloseHandle (hFile);
if (!result && delete_on_error)
DeleteFileW (w_path);
if (w_path)
if (!result && delete_on_error)
DeleteFileW (w_path);
if (w_path)