converse of cygwin_attach_handle_to_fd()?

Dave Korn
Mon Jun 5 13:48:00 GMT 2006

On 04 June 2006 00:10, Samuel Thibault wrote:

> Hi,
> cygwin_attach_handle_to_fd() lets create a cygwin fd on top of a windows
> handle. When calling close() on the fd, the windows handle is closed
> too. Is there any way to close the fd without closing the underlying
> handle? (i.e. the converse of cygwin_attach_handle_to_fd(), actually)

  Well, the simple workaround would be to write a wrapper function for
cygwin_attach_handle_to_fd; the wrapper would call DuplicateHandle to get a
spare copy of the original handle and then pass that duplicated handle to
cygwin_attach_handle_to_fd instead of the original handle; that way, when you
close the fd, the duplicate of the handle is closed, entirely independently of
the original.

Can't think of a witty .sigline today....

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list