serious problem with cygwin and winsock?
Tue Aug 21 19:17:00 GMT 2001
I've been going crazy this last week trying to figure out a problem
with cygwin and rshd. It is one of those problems that disappear if
you run strace or single step in gdb.
What happens is that rshd sometimes ends up passing a 0 as the first
argument to execle when it is supposed to be something like:
"bash", "-c", "ls", 0
or whatever. In my scenario the "bash" is sometimes NULL.
One thing I noticed is that rshd uses the structure returned by getpwnam
after calling endpwent. Anyone know if that is a valid thing to do?
After calling endpwent, rshd uses the pw_shell part of the structure.
Another thing I've noticed is that older versions of rshd used to use
the result of a gethostbyname call after a fork. This is where the
"serious" part of the problem enters in. Apparently this call uses
memory that is not allocated again after a fork, so if you do a:
struct hostent *hp = gethostbyname ("foo");
if (fork() == 0)
printf ("%s\n", hp->h_name);
hp will not point to valid memory since it hasn't been duplicated by the
The only way that I can think of to work around this is to wrap every single
wsock call that returns a static buffer or somehow know enough to copy the
data sections of non-cygwin DLLs.
Anyway, does anyone have any insight into either what could be causing my
first problem or how to fix the second?
More information about the Cygwin-developers