X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f Date: Sat, 19 Jan 2002 14:44:49 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: Richard Dawe Message-Id: <3099-Sat19Jan2002144449+0200-eliz@is.elta.co.il> X-Mailer: emacs 21.2.50 (via feedmail 8 I) and Blat ver 1.8.9 CC: djgpp-workers AT delorie DOT com In-reply-to: <3C495559.C01A23AF@phekda.freeserve.co.uk> (message from Richard Dawe on Sat, 19 Jan 2002 11:15:37 +0000) Subject: Re: env.exe crash - reproducible test program References: <10201180538 DOT AA24590 AT clio DOT rice DOT edu> <3C495559 DOT C01A23AF AT phekda DOT freeserve DOT co DOT uk> Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > Date: Sat, 19 Jan 2002 11:15:37 +0000 > From: Richard Dawe > > /* > > This routine assumes that the environ array and all strings it > points to were malloc'd. Nobody else should modify the environment > except crt1.c > > */ To clarify: what this comment _really_ wants to tell is that the original environ, the one putenv sees on its very first call, _must_ be malloc'ed. Once the first call was made (typically, by the startup code), it is okay to do what the test program did, i.e. replace environ with a non-malloc'ed array. It's quite possible that this explains the cause for the: If having $DJGPP undefined prevents putenv from being called during startup even once, putenv will indeed be unable to cope with such code. This suggests a solution: add a dummy putenv call to the startup code, which will be called unconditionally.