From owner-cvs-all Sat Oct 10 22:12:58 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id WAA17553 for cvs-all-outgoing; Sat, 10 Oct 1998 22:12:58 -0700 (PDT) (envelope-from owner-cvs-all@FreeBSD.ORG) Received: from spinner.netplex.com.au (spinner.netplex.com.au [202.12.86.3]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id WAA17546; Sat, 10 Oct 1998 22:12:33 -0700 (PDT) (envelope-from peter@netplex.com.au) Received: from spinner.netplex.com.au (localhost [127.0.0.1]) by spinner.netplex.com.au (8.9.1/8.9.1/Spinner) with ESMTP id MAA18868; Sun, 11 Oct 1998 12:44:43 +0800 (WST) (envelope-from peter@spinner.netplex.com.au) Message-Id: <199810110444.MAA18868@spinner.netplex.com.au> X-Mailer: exmh version 2.0.2 2/24/98 To: Bruce Evans cc: bde@FreeBSD.ORG, cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG Subject: Re: cvs commit: src/lib/libc/gen popen.c In-reply-to: Your message of "Sun, 11 Oct 1998 14:40:28 +1000." <199810110440.OAA08152@godzilla.zeta.org.au> Date: Sun, 11 Oct 1998 12:44:43 +0800 From: Peter Wemm Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk Bruce Evans wrote: > More vfork breakage: vfork is used in about 50 programs in /usr/src. > It is misused in all 7 programs that I looked at: > > as cron libdialog mv rcp rcs vipw > > Most of these call execl() from the forked child. cron calls execvp(), > which calls strdup(). I suspect this has come about because of a change of implementation in exec*(). I suspect they used to do something like: execl(arg1, arg2) { execve(arg1, &arg1, environ); } ... but since prototypes has been changed to use malloc etc and build an array by sucking in args via va_arg() etc. IMHO, it's bad form for exec* to call malloc. I've been burned before with exec() calls mysteriously failing that turned out to be malloc corruption. The implementation would be better to use something else. Since we presently depend on the gcc environment, we could use it's extensions... execl() { int count; char **argv; count = (args by walking through the va_list with va_arg()); .. and rest of exec processing.. { char *newargv[count + 1]; .. copy arg pointers into newargv .. execve(path, newargv); } } This will work on all platforms we are likely to support. > Bruce > Cheers, -Peter -- Peter Wemm Netplex Consulting "No coffee, No workee!" :-) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message