From 840ac3504f4e8d2f7aed2eb75e854fe1402d59b3 Mon Sep 17 00:00:00 2001 From: hvlad Date: Wed, 15 Apr 2015 22:10:06 +0000 Subject: [PATCH] This should fix bug CORE-4753 : Firebird hangs in embed mode --- src/jrd/isc_sync.cpp | 8 ++++++++ src/jrd/os/win32/isc_ipc.cpp | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/jrd/isc_sync.cpp b/src/jrd/isc_sync.cpp index 0acf1134be..3a3352c807 100644 --- a/src/jrd/isc_sync.cpp +++ b/src/jrd/isc_sync.cpp @@ -2615,6 +2615,8 @@ UCHAR* ISC_map_file(ISC_STATUS* status_vector, Arg::Gds(isc_unavailable).copyTo(status_vector); return NULL; } + + SetHandleInformation(event_handle, HANDLE_FLAG_INHERIT, 0); } if (length == 0) @@ -2739,6 +2741,7 @@ UCHAR* ISC_map_file(ISC_STATUS* status_vector, CloseHandle(file_handle); goto retry; } + SetHandleInformation(header_obj, HANDLE_FLAG_INHERIT, 0); ULONG* const header_address = (ULONG*) MapViewOfFile(header_obj, FILE_MAP_WRITE, 0, 0, 0); @@ -2791,6 +2794,7 @@ UCHAR* ISC_map_file(ISC_STATUS* status_vector, CloseHandle(file_handle); return NULL; } + SetHandleInformation(file_obj, HANDLE_FLAG_INHERIT, 0); UCHAR* const address = (UCHAR*) MapViewOfFile(file_obj, FILE_MAP_WRITE, 0, 0, 0); @@ -3715,6 +3719,8 @@ static bool initializeFastMutex(FAST_MUTEX* lpMutex, LPSECURITY_ATTRIBUTES lpAtt if (lpMutex->hEvent) { + SetHandleInformation(lpMutex->hEvent, HANDLE_FLAG_INHERIT, 0); + if (lpName) sprintf(sz, FAST_MUTEX_MAP_NAME, lpName); @@ -3730,6 +3736,8 @@ static bool initializeFastMutex(FAST_MUTEX* lpMutex, LPSECURITY_ATTRIBUTES lpAtt if (lpMutex->hFileMap) { + SetHandleInformation(lpMutex->hFileMap, HANDLE_FLAG_INHERIT, 0); + lpMutex->lpSharedInfo = (FAST_MUTEX_SHARED_SECTION*) MapViewOfFile(lpMutex->hFileMap, FILE_MAP_WRITE, 0, 0, 0); diff --git a/src/jrd/os/win32/isc_ipc.cpp b/src/jrd/os/win32/isc_ipc.cpp index 519cfce797..6c2120db3f 100644 --- a/src/jrd/os/win32/isc_ipc.cpp +++ b/src/jrd/os/win32/isc_ipc.cpp @@ -181,6 +181,9 @@ void* ISC_make_signal(bool create_flag, bool manual_reset, int process_idL, int hEvent = CreateEvent(ISC_get_security_desc(), man_rst, FALSE, event_name); } + if (hEvent) { + SetHandleInformation(hEvent, HANDLE_FLAG_INHERIT, 0); + } return hEvent; }