This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

fork() incorrectly invalidates socket fd


i think i found a bug in version 1.3.3 of cygwin. fork() appeares to
be causing a file descriptor to be invalidated.

when i try to recv(), i get the following error:

The descriptor is a file, not a socket

so, i'll hook you up with the code that's causing the error. it's a
proxy server and to be honest, i'm not sure that it totally works on
windows. i do know, however, that this bug is one thing in the
way. the reason i point that out is maybe when you fix the bug the
proxy still won't work, and that's my fault.

you can grab my current working source at
http://ghetto.kxfish.org/~andrew/nylon-bug.tar.gz

just do (here's where i patronize you, sorry):
tar -xzvf nylon-bug.tar.gz
cd nylon
./nylon.exe -v

it should say "starting up" and stuff. try running AOL instant
messenger (or some app that uses a proxy) now and tell it to use a
proxy. a socks4 proxy connected to 127.0.0.1 on port 1080. you should
get the proper error message in the terminal window when you try to
connect.

check out nylon.c line 233. that "----ok----" would show up twice on
the display if the bug in cygwin wasn't in existence.

anyway, if you seem to erradicate the bug and want to see if the proxy
works (no promises!), remove the following lines (nylon.c 231 to 233):

	if ( recvn(nsfd, &vn, 1, 0) == -1 )
	fatal_error("error receiving version number\n");
	printf("-------ok------\n");

well, thanks so much, cygwin people. you put out a great product!

-andrew

--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]