"Juan Lang" juan_lang@yahoo.com wrote:
- if (DuplicateHandle(GetCurrentProcess(), MSVCRT_fdesc[od].handle,
GetCurrentProcess(), &handle, 0,
!(MSVCRT_fdesc[od].wxflag & WX_DONTINHERIT), DUPLICATE_SAME_ACCESS))
- {
ret = msvcrt_alloc_fd(handle, MSVCRT_fdesc[od].wxflag);
if (ret == -1)
*MSVCRT__errno() = MSVCRT_EMFILE;
- }
You need to close duplicated handle in the case of msvcrt_alloc_fd failure.