| www.delorie.com/archives/browse.cgi | search |
| 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 <peuha AT cc DOT helsinki DOT fi> |
| 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: | <Pine.OSF.4.58.0411291042160.18832@sirppi.helsinki.fi> |
| References: | <41A5BBC6 DOT 18442 DOT 2294B0C AT localhost> <41AADB99 DOT 14622 DOT 194D345 AT localhost> |
| MIME-Version: | 1.0 |
| 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 |
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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |