From owner-cvs-all Tue Mar 23 8:40:54 1999 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 2C19614DCC; Tue, 23 Mar 1999 08:40:53 -0800 (PST) (envelope-from peter@FreeBSD.org) Received: (from peter@localhost) by freefall.freebsd.org (8.9.2/8.9.2) id IAA12427; Tue, 23 Mar 1999 08:40:35 -0800 (PST) (envelope-from peter@FreeBSD.org) Message-Id: <199903231640.IAA12427@freefall.freebsd.org> From: Peter Wemm Date: Tue, 23 Mar 1999 08:40:35 -0800 (PST) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/lib/libc/gen exec.c Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk peter 1999/03/23 08:40:35 PST Modified files: lib/libc/gen exec.c Log: Remove last remaining references to malloc/realloc and functions that call them. All the execX() libc functions should be vfork() safe now. Specifically: - execlp() does the argument count-and-build into a vector from alloca (like the others) - buildargv() is no longer used (and gone). - execvp() uses alloca/strcpy rather than strdup(). - the ENOEXEC handler uses alloca rather than malloc. - a couple of free() calls removed - alloca works on the local stack and the allocations are freed on function exit (which is why buildargv wasn't useful - it's alloca() context would disappear on return). Along the way: - If alloca() fails (can it?), set errno = ENOMEM explicitly. - The ENOEXEC recovery routine that trys again with /bin/sh appeared to not be terminating the new argv[] array for /bin/sh, allowing it to walk off the end of the list. I dithered a bit about using alloca() even more as it's most commonly associated with gcc. However, standalone portable (using malloc) and machine-specific assembler alloca implementations appear to be available on just about all the architectures we're likely to want to port to. alloca will be the least of our problems if ever going to another compiler. Revision Changes Path 1.11 +40 -50 src/lib/libc/gen/exec.c To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message