mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 14:03:07 +01:00
Fixed bug CORE-2864 : Listener process of Classic Server leak handles.
This commit is contained in:
parent
3f33b38857
commit
d19395459f
@ -1631,7 +1631,7 @@ static void wsaExitHandler(void*)
|
||||
}
|
||||
|
||||
|
||||
static int fork(SOCKET handle, USHORT flag)
|
||||
static int fork(SOCKET old_handle, USHORT flag)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -1646,8 +1646,17 @@ static int fork(SOCKET handle, USHORT flag)
|
||||
TEXT name[MAXPATHLEN];
|
||||
GetModuleFileName(NULL, name, sizeof(name));
|
||||
|
||||
HANDLE new_handle;
|
||||
if (!DuplicateHandle(GetCurrentProcess(), (HANDLE) old_handle,
|
||||
GetCurrentProcess(), &new_handle,
|
||||
0, TRUE, DUPLICATE_SAME_ACCESS))
|
||||
{
|
||||
gds__log("INET/inet_error: fork/DuplicateHandle errno = %d", GetLastError());
|
||||
return 0;
|
||||
}
|
||||
|
||||
Firebird::string cmdLine;
|
||||
cmdLine.printf("%s -i -h %"HANDLEFORMAT"@%"ULONGFORMAT, name, handle, GetCurrentProcessId());
|
||||
cmdLine.printf("%s -i -h %"HANDLEFORMAT"@%"ULONGFORMAT, name, new_handle, GetCurrentProcessId());
|
||||
|
||||
STARTUPINFO start_crud;
|
||||
start_crud.cb = sizeof(STARTUPINFO);
|
||||
@ -1672,7 +1681,7 @@ static int fork(SOCKET handle, USHORT flag)
|
||||
}
|
||||
|
||||
gds__log("INET/inet_error: fork/CreateProcess errno = %d", GetLastError());
|
||||
SOCLOSE(handle);
|
||||
CloseHandle(new_handle);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1699,6 +1708,7 @@ THREAD_ENTRY_DECLARE forkThread(THREAD_ENTRY_PARAM arg)
|
||||
forkSockets->remove((size_t) 0);
|
||||
}
|
||||
fork(s, flag);
|
||||
SOCLOSE(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user