WSAEventSelect did ignore the lNetworkEvents argument.
In case this argument is 0, the non blocking socket must
be set to blocking again to mimic windows behavior.
Allows the WinPR HANDLE functions WaitForSingleObject and
WaitForMultipleObjects to signal in case of write events.
This is used by CreateFileDescriptor and SetEventFileDescriptor,
which got an API change accomodating for this new feature.
If SA_SIGINFO isn't set in the flags sa_handler is used
instead of sa_sigaction.
This fixes also the compiler warning:
FreeRDP/winpr/libwinpr/thread/process.c: In function ‘_CreateProcessExA’:
FreeRDP/winpr/libwinpr/thread/process.c:282:20: warning: assignment from
incompatible pointer type [enabled by default]
The calling thread of CreateProcess can be in any library and
can have arbitrary signal masks and handlers.
We now save the caller's mask and block all signals before forking.
After fork:
- child resets the handlers and unblocks all signals.
- parent restores the caller's original signal mask.
This patch contains:
* checks for malloc return value + treat callers;
* modified malloc() + ZeroMemory() to calloc();
* misc fixes of micro errors seen during the code audit:
** some invalid checks in gcc.c, also there were some possible
integer overflow. This is interesting because at the end the data are parsed
and freed directly, so it's a vulnerability in some kind of dead code (at least
useless);
** fixed usage of GetComputerNameExA with just one call, when 2 were used
in misc places. According to MSDN GetComputerNameA() is supposed to return
an error when called with NULL;
** there were a bug in the command line parsing of shadow;
** in freerdp_dynamic_channel_collection_add() the size of array was multiplied
by 4 instead of 2 on resize
Unless there is an invalid parameter or internal error, ResetEvent
must return TRUE, even if the object is in nonsignaled state.
Also fixed and improved the CTest TestSynchEvent to test for the
expected/correct SetEvent and ResetEvent return values.
Note: This commit does NOT really fix PathAllocCombine!
- print a warning message that the function is buggy and added a code
comment describing the issues
- fix misuse of the S_FALSE HRESULT in error conditions
- prevent some segfaults
- check result of HeapAlloc
Fortunately PathAllocCombine is unused in FreeRDP