Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Mar 1999 08:40:35 -0800 (PST)
From:      Peter Wemm <peter@FreeBSD.org>
To:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   cvs commit: src/lib/libc/gen exec.c
Message-ID:  <199903231640.IAA12427@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199903231640.IAA12427>