Mail Archives: cygwin/2002/01/30/20:44:10
On Thu, Jan 31, 2002 at 12:18:24AM +0100, Lapo Luchini wrote:
>I don't think I have enough knowledge on the "fork() in cygwin" subject to
>evaluate if there are better solutions, I reply also in the mailing list.
>
>Lapo
>
>BTW: I'll try the fix soon, just wanted some more "advice from the gurus"
>about the issue ;)
>
>Chuck Messenger wrote:
>
>> Hi Lapo,
>>
>> I've been trying out the Cygwin port of rsync -- version 2.5.1. I've
>> found that it doesn't work in server (i.e. --daemon) mode on my Win2k
>> box, but it does work on my Win98 box.
>>
>> I did some debugging, and came up with a fix.
>>
>> In socket.c, we have the following code which the server executes after
>> being connected to by a client:
>>
>> if (fork()==0) {
>> close(s);
>> /* open log file in child before possibly giving
>> up privileges */
>> log_open();
>> _exit(fn(fd));
>> }
>>
>> >>> delay(1); /* CHM addition */
>>
>> close(fd);
>>
>> I've marked my addition with >>>. What seems to happen on Win2k is that
>> the close(fd) gets called by the mother process before the child process
>> gets going.
Sorry, but this is as impossible on cygwin as it is on UNIX.
I am not saying that there can't be a problem but the analysis that the
parent process is closing something in the child really can't be
correct.
As always, I'd appreciate debugging of this situation. It's a given
that one doesn't implicitly have knowledge. You have to gain knowledge
by looking at the code and running the debugger. The techniques in
the file how-to-debug-cygwin.txt should provide you with ways to get
started.
cgf
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -