X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f Date: Mon, 29 Nov 2004 10:45:10 +0200 (EET) From: Esa A E Peuha Sender: peuha AT sirppi DOT helsinki DOT fi To: djgpp-workers AT delorie DOT com Subject: Re: A fix for popen(). In-Reply-To: <41AADB99.14622.194D345@localhost> Message-ID: References: <41A5BBC6 DOT 18442 DOT 2294B0C AT localhost> <41AADB99 DOT 14622 DOT 194D345 AT localhost> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 On Mon, 29 Nov 2004, Juan Manuel Guerrero wrote: > In conclusion, or calloc > must be used to allocte the struct or all struct elements must be initialized to some > sane default. No need to do either, the test just needs to be for the file mode: Index: popen.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/posix/stdio/popen.c,v retrieving revision 1.7 diff -u -r1.7 popen.c --- popen.c 29 Nov 2004 08:37:03 -0000 1.7 +++ popen.c 29 Nov 2004 08:41:23 -0000 @@ -247,7 +247,7 @@ exit: - if (l1->command) + if (l1->mode[0] == 'w') free(l1->command); free(l1); -- Esa Peuha student of mathematics at the University of Helsinki http://www.helsinki.fi/~peuha/