Mail Archives: cygwin/2009/08/14/05:09:24
http://cygwin.com/acronyms/#TOFU
On Aug 14 00:44, cygwin wrote:
> Further tests with this little program show that the observed error only
> occurs when the socket is dup()'ed to STDIN (fd = 0), but not when
> dup'ed to any other fd number. To test, replace STDIN_FILENO in the dup
> call with any positive integer (except 3 and 4).
> Also, explicitly closing STDIN in advance of the dup call has no effect,
> as it should since dup should close exisiting fd automatically.
> This moves the problem area at least down into dtable::dup_worker and
> build_fh_pc()
> how is STDIN handled differently?
> [...]
>>> I wrote a small test program to isolate the problem from RSYNC.
>>> The problem occurs when a file descriptor obtained from socketpair()
>>> is dup2()'ed into STDIN and then closed. The close call fails.
>>> Output from the program is as follows:
>>>
>>> socket 1 = 3
>>> socket 2 = 4
>>> dup2 socket 1...
>>> closing socket 1...
>>> close: Socket operation on non-socket
>>> closing socket 1 failed
>>>
>>>
>>> It is interesting to note that the close() is successful when the
>>> dup2 calling sequence is omitted.
>>> Since socketpair() in cygwin appears to use AF_INET sockets to
>>> simulate AF_UNIX it might be interesting to try this on a single INET
>>> socket.
I tried your test application under Cygwin 1.7.0-58 on XP SP3, 2003 R2
x64 SP2, 2008 SP2, W7, W7 x64, to no avail. On all systems the test
runs fine. Did you look for http://cygwin.com/acronyms/#BLODA and
http://cygwin.com/1.7/faq/faq.using.html#faq.using.bloda?
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
- Raw text -