summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/exec.c
Commit message (Collapse)AuthorAgeFilesLines
* Fixed searching of $PATH in execvp(). Do what sh(1) should do accordingbde1997-10-141-9/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | to POSIX.2. In particular: - don't retry for ETXTBSY. This matches what sh(1) does. The retry code was broken anyway. It only slept for several seconds for the first few retries. Then it retried without sleeping. - don't abort the search for errors related to the path prefix, in particular for ENAMETOOLONG, ENOTDIR, ELOOP. This fixes PR1487. sh(1) gets this wrong in the opposite direction by never aborting the search. - don't confuse EACCES for errors related to the path prefix with EACCES for errors related to the file. sh(1) gets this wrong. - don't return a stale errno when the search terminates normally without finding anything. The errno for the last unsuccessful execve() was usually returned. This gave too much precedence to pathologies in the last component of $PATH. This bug is irrelevant for sh(1). The implementation still uses the optimization/race-inhibitor of trying to execve() things first. POSIX.2 seems to require looking at file permissions using stat(). We now use stat() after execve() if execve() fails with an ambiguous error. Trying execve() first may actually be a pessimization, since failing execve()s are fundamentally a little slower than stat(), and are significantly slower when a file is found but has unsuitable permissions or points to an unsuitable interpreter. PR: 1487
* Fixed execvp() of an empty pathname to fail POSIXly. Previously itbde1996-11-181-0/+6
| | | | | | | attempted to exec the components of $PATH and it usually set errno to the wrong value. Found by: NIST PCTS
* Fixed uninitialized variables for the '/'-in-pathname case in execvp().bde1996-11-181-1/+2
| | | | | | | | Garbage in `eacces' caused the wrong errno to be set for non-EACCES errors. Garbage in `etxtbsy' caused a semi-random retry strategy for ETXTBSY errors. Found by: NIST-PCTS. gcc -Wall reported the problem, but -Wall is not enabled for libc.
* General -Wall warning cleanup, part I.jkh1996-07-121-4/+4
| | | | Submitted-By: Kent Vander Velden <graphix@iastate.edu>
* Fix execl[e]. Multiple execle's failed because of bogus caching of thebde1994-12-121-16/+14
| | | | | | | | pointer returned by realloc(). All callers free the pointer if the execve fails. Nuke the caching. This essentially restores buildargv() to the 1.1.5 version. Also fix a memory leak if realloc() fails. Also nuke similar but non-broken caching in execvp(). malloc() should be efficient enough.
* BSD 4.4 Lite Lib Sourcesrgrimes1994-05-271-0/+271
OpenPOWER on IntegriCloud