environ defined twice

crvich@raleigh.ibm.com crvich@raleigh.ibm.com
Tue Apr 29 06:36:00 GMT 1997

	Version: beta 17.1
	Platform: WinNT 4.00.1381

	Not sure if this has already been discussed (I searched the
archives, which only run through Dec 22, to no avail), but I've found
that environ is defined in both libc.a (environ.c) and libcygwin.a
(libccrt0.cc).  This causes confusing results, since the stdlib.h
functions (setenv, putenv, getenv) seem to be using "their" version,
while a browse through environ directly by my program uses the "other"
version.  Both versions are initially the same, but once you begin
modifying environ (with either the stdlib.h functions or directly
yourself), their uniqueness becomes apparent.

	My main concern is the way fork() and exec() behave (I'm
invariably invoking a shell, "cmd" for now), since they cause different
versions of environ to be visible to an invoked program...exec() by
itself causes the "other" version (the one that was altered manually)
to be seen by the invoked program, while fork() allows a subsequent
exec() to see the stdlib.h version.

	I assume an "extern" was forgotten in the libccrt0.cc 
declaration, correct?  Any simple fix in the meantime, aside from
changing libccrt0.cc myself and trying to update cygwin.dll?
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

More information about the Cygwin mailing list