From owner-cvs-all Sun Oct 11 02:06:57 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id CAA04799 for cvs-all-outgoing; Sun, 11 Oct 1998 02:06:57 -0700 (PDT) (envelope-from owner-cvs-all@FreeBSD.ORG) Received: from apollo.backplane.com (apollo.backplane.com [209.157.86.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id CAA04794; Sun, 11 Oct 1998 02:06:48 -0700 (PDT) (envelope-from dillon@backplane.com) Received: (dillon@localhost) by apollo.backplane.com (8.9.1/8.6.5) id CAA02043; Sun, 11 Oct 1998 02:06:17 -0700 (PDT) Date: Sun, 11 Oct 1998 02:06:17 -0700 (PDT) From: Matthew Dillon Message-Id: <199810110906.CAA02043@apollo.backplane.com> To: Peter Wemm Cc: Bruce Evans , cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/lib/libc/gen popen.c References: <199810110309.LAA18511@spinner.netplex.com.au> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk :Bruce Evans wrote: :> bde 1998/10/10 12:30:45 PDT :> :> Modified files: :> lib/libc/gen popen.c :> Log: :> vfork -> fork. The child calls execl() which calls malloc(), so :> vfork() can't be used. We could use alloca() in execl() so that :> it can be called between vfork() and execve(), but a "portable" :... : :Why not fix it properly by not using execl()? Wait a second!!!!!! vfork() was specifically designed for situations where you call the exec*() functions. That's the whole point of using vfork() rather then fork()!!!!! If execl() is not compatible with vfork(), then execl() is seriously broken. And I do mean seriously. I can't begin to count the number of times I use vfork()/execl() in programs. The problem ought to be easily solvable by having the exec*() functions cache the returned argv in a static and 'free' them on the following call before allocating a new copy, so the parent process does not leak memory. Frankly, I'd prefer a solution that doesn't touch malloc at all... if it were me I'd just take &arg and be done with it, but alloca() is probably better then that. Still not fun, but better. -Matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message