msvcrt: implement _dup (take 2)

Dmitry Timoshkov dmitry at baikal.ru
Mon Dec 6 23:22:36 CST 2004


"Juan Lang" <juan_lang at 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.

-- 
Dmitry.




More information about the wine-devel mailing list