freebsd-nq/lib/libc/gen
Bruce Evans 1df595f25d Fixed searching of $PATH in execvp(). Do what sh(1) should do according
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
1997-10-14 07:23:16 +00:00
..
__xuname.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
_rand48.c Added *ran48 functions, and put them in the correct place this time. 1994-09-23 00:37:55 +00:00
alarm.3 Describe upper limit based on itimerfix restriction 1997-08-14 07:44:57 +00:00
alarm.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
arc4random.3 Change u_char which require special include to unsigned char 1997-06-14 01:28:59 +00:00
arc4random.c Add arc4random() functions from OpenBSD. They are almost same as our 1997-06-14 01:15:41 +00:00
assert.c Don't include <sys/types.h> when it isn't used. 1996-04-19 18:40:25 +00:00
clock.3 Removed bogus includes of <sys/types.h> from synopses. 1996-04-19 19:00:26 +00:00
clock.c Change CLK_TCK to CLOCKS_PER_SEC. (CLK_TCK is a deprecated POSIX feature 1995-02-03 21:59:45 +00:00
closedir.c General -Wall warning cleanup, part I. 1996-07-12 18:57:58 +00:00
config_open.3 Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
config.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
confstr.3 Correctly use .Fn instead of .Nm to reference function names 1996-08-22 23:31:07 +00:00
confstr.c Minor cleanup, mostly unused vars and missing #includes. 1995-10-22 14:37:11 +00:00
crypt.3 Fixed #include and/or prototype bugs in synopsis. 1997-04-13 13:16:20 +00:00
crypt.c Minor cleanup, mostly unused vars and missing #includes. 1995-10-22 14:37:11 +00:00
ctermid.3 Added missing section numbers to a bunch of .Xr macros, or 1996-03-27 20:49:07 +00:00
ctermid.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
daemon.3 Correctly use .Fn instead of .Nm to reference function names 1996-08-22 23:31:07 +00:00
daemon.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
devname.3 Merge from Lite2: man page updates 1997-03-11 11:47:52 +00:00
devname.c Import CSRG 4.4BSD-Lite2 lib/libc onto vendor branch 1997-03-11 11:29:42 +00:00
directory.3 Sort cross references. 1997-01-20 23:23:22 +00:00
disklabel.c Merge from Lite2: 1997-03-11 11:52:33 +00:00
drand48.c Added *ran48 functions, and put them in the correct place this time. 1994-09-23 00:37:55 +00:00
erand48.c Added *ran48 functions, and put them in the correct place this time. 1994-09-23 00:37:55 +00:00
err.3 Added missing #include of <stdarg.h> to synopsis. Moved prototypes for 1997-03-19 00:43:13 +00:00
err.c Don't use __dead or __pure in user code. They were obfuscations 1996-09-14 03:00:32 +00:00
errlst.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
exec.3 Fixed searching of $PATH in execvp(). Do what sh(1) should do according 1997-10-14 07:23:16 +00:00
exec.c Fixed searching of $PATH in execvp(). Do what sh(1) should do according 1997-10-14 07:23:16 +00:00
fnmatch.3 Merge from Lite2: man page updates 1997-03-11 11:47:52 +00:00
fnmatch.c Style optimization in newly added POSIX range []] conformance, redo 1997-06-07 01:33:10 +00:00
frexp.3 Sort cross references. 1997-01-20 23:23:22 +00:00
fstab.c Minor cleanup, mostly unused vars and missing #includes. 1995-10-22 14:37:11 +00:00
ftok.3 FIxed arg types (mostly missing consts) in synopsis. 1997-03-19 00:58:07 +00:00
ftok.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
fts-compat.c Apply fts() fix from PR#4593 1997-09-22 12:48:40 +00:00
fts-compat.h Back out all of yesterdays include file changes. 1997-05-07 20:01:10 +00:00
fts.3 The first argument to fts_set was wrong. Part of PR# 2917. 1997-03-09 00:43:49 +00:00
fts.c Apply fts() fix from PR#4593 1997-09-22 12:48:40 +00:00
getbootfile.3 Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
getbootfile.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
getbsize.3 Update a bunch of man pages to use .Fn instead 1996-08-22 22:05:59 +00:00
getbsize.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
getcap.3 Show the real revision date and not the date that this 1997-06-23 04:03:49 +00:00
getcap.c Many places in the code NULL is used in integer context, where 1997-09-18 14:08:40 +00:00
getcwd.3 Fixed various problems: typos, grammer, missing include files 1996-05-23 01:05:25 +00:00
getcwd.c Put a system call not present checking wrapper around the call to 1997-09-16 06:00:50 +00:00
getdiskbyname.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
getdomainname.3 Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
getdomainname.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
getfsent.3 Update to reflect current include files. 1997-01-30 23:01:49 +00:00
getgrent.3 Correct the xref section - it was incorrectly using .Fn instead 1997-02-28 05:46:19 +00:00
getgrent.c Allow comments in group database. 1997-03-08 16:21:40 +00:00
getgrouplist.3 Correctly use .Fn instead of .Nm to reference function names 1996-08-22 23:31:07 +00:00
getgrouplist.c Fixed merging error. Lite2 fixed premature failure and didn't 1997-03-12 14:54:22 +00:00
gethostname.3 Update a bunch of man pages to use .Fn instead 1996-08-22 22:05:59 +00:00
gethostname.c gethostname() returns int, not long. Answered my own question by 1996-12-05 18:14:56 +00:00
getloadavg.3 Fixed missing function types in synopsis. 1997-03-19 00:32:42 +00:00
getloadavg.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
getlogin.c Don't add/subtract 1 to MAXLOGNAME, it is already NUL-terminated 1997-03-03 08:11:28 +00:00
getmntinfo.3 Sort cross references. 1997-01-20 23:23:22 +00:00
getmntinfo.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
getnetgrent.3 FIxed arg types (mostly missing consts) in synopsis. 1997-03-19 00:52:58 +00:00
getnetgrent.c Improve the innetgr() NIS+ compat kludge. We should only fail over to the 1997-10-13 17:09:15 +00:00
getosreldate.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
getpagesize.3 Sort cross references. 1997-01-20 23:23:22 +00:00
getpagesize.c Cache the result of getpagesize() so we only make one syscall. 1996-05-02 08:43:05 +00:00
getpass.3 Update a bunch of man pages to use .Fn instead 1996-08-22 22:05:59 +00:00
getpass.c General -Wall warning cleanup, part I. 1996-07-12 18:57:58 +00:00
getpwent.3 Update to reflect current include files. 1997-01-30 23:01:49 +00:00
getpwent.c Many places in the code NULL is used in integer context, where 1997-09-18 14:08:40 +00:00
getttyent.3 Fixed another prototype bug in synopsis. 1997-04-14 13:37:18 +00:00
getttyent.c Fix typo. 1997-04-13 16:55:56 +00:00
getusershell.3 Fixed #include and/or prototype bugs in synopsis. 1997-04-13 13:16:20 +00:00
getusershell.c Remove trailing whitespace. 1995-05-30 05:51:47 +00:00
getvfsbyname.3 More cleanup - I didn't realize that this was a new man page 1997-03-12 15:21:57 +00:00
getvfsbyname.c Enabled the Lite2 getvfsbyname(). It's actually named new_getvfsbyname() 1997-03-03 13:08:33 +00:00
getvfsent.3 Change vfc_typenum back to vfc_index in response to bde's 1997-03-03 06:02:54 +00:00
getvfsent.c Changed vfc_typenum back to vfc_index. The old vfsconf struct is now 1997-03-03 05:53:54 +00:00
glob.3 Fixed #include and/or prototype bugs in synopsis. 1997-04-13 13:16:20 +00:00
glob.c Use getpwnam(getlogin()) before getpwuid(getuid()) 1997-08-27 13:36:34 +00:00
initgroups.3 Typo police. Part of PR# 3242. 1997-04-09 23:05:04 +00:00
initgroups.c General -Wall warning cleanup, part I. 1996-07-12 18:57:58 +00:00
isatty.c Reviewed by: julian and (hsu?) 1996-01-22 00:02:33 +00:00
isinf.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
jrand48.c Added *ran48 functions, and put them in the correct place this time. 1994-09-23 00:37:55 +00:00
lcong48.c Added *ran48 functions, and put them in the correct place this time. 1994-09-23 00:37:55 +00:00
ldexp.3 Sort cross references. 1997-01-20 23:23:22 +00:00
lrand48.c Added *ran48 functions, and put them in the correct place this time. 1994-09-23 00:37:55 +00:00
Makefile.inc Initial elf nlist support, mostly stolen from OpenBSD (they use standard 1997-08-31 00:08:35 +00:00
modf.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
mrand48.c Added *ran48 functions, and put them in the correct place this time. 1994-09-23 00:37:55 +00:00
msgctl.3 Update to reflect current include files. 1997-01-30 23:01:49 +00:00
msgctl.c Added SYSV ipc system calls. 1994-09-13 14:52:45 +00:00
msgget.3 Mdoc cleanup. 1997-03-21 20:46:30 +00:00
msgget.c Added SYSV ipc system calls. 1994-09-13 14:52:45 +00:00
msgrcv.3 Mdoc cleanup. 1997-03-21 20:46:30 +00:00
msgrcv.c Added SYSV ipc system calls. 1994-09-13 14:52:45 +00:00
msgsnd.3 Mdoc cleanup. 1997-03-21 20:46:30 +00:00
msgsnd.c Added SYSV ipc system calls. 1994-09-13 14:52:45 +00:00
nice.3 Fixed missing function types in synopsis. 1997-03-19 00:32:42 +00:00
nice.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
nlist.3 Correct some man page xrefs, and some other minor changes to bring some 1996-04-08 04:18:31 +00:00
nlist.c Initial elf nlist support, mostly stolen from OpenBSD (they use standard 1997-08-31 00:08:35 +00:00
nrand48.c Added *ran48 functions, and put them in the correct place this time. 1994-09-23 00:37:55 +00:00
ntp_gettime.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
opendir.c Fixed errors in the Lite2 merge. Some style changes were mismerged. 1997-03-12 12:35:44 +00:00
pause.3 Pause() is made obsolete by sigsuspend(2), not sigpause(3). 1997-03-09 00:42:46 +00:00
pause.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
popen.3 Document that popen() uses a bidirectional pipe (in FreeBSD) and not a 1997-03-11 19:28:24 +00:00
popen.c FIxed the cleanup. I forgot to leave stdin alone in the usual (!twoway) 1997-04-22 09:44:06 +00:00
psignal.3 Fixed #include and/or prototype bugs in synopsis. 1997-04-13 13:16:20 +00:00
psignal.c Minor cleanup, mostly unused vars and missing #includes. 1995-10-22 14:37:11 +00:00
pw_scan.c Staticize usage(). Cosmetics. 1997-10-10 06:27:07 +00:00
pw_scan.h BSD 4.4 Lite usr.sbin Sources 1994-05-26 05:23:31 +00:00
pwcache.3 Fixed #include and/or prototype bugs in synopsis. 1997-04-13 13:16:20 +00:00
pwcache.c Honor the nouser/nogroup flag when determing if NULL should 1997-04-03 01:51:34 +00:00
raise.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
raise.c General -Wall warning cleanup, part I. 1996-07-12 18:57:58 +00:00
rand48.3 Fix even more spelling errors in some more man pages. 1996-01-30 16:34:52 +00:00
rand48.h Added *ran48 functions, and put them in the correct place this time. 1994-09-23 00:37:55 +00:00
readdir.c Import CSRG 4.4BSD-Lite2 lib/libc onto vendor branch 1997-03-11 11:29:42 +00:00
rewinddir.c General -Wall warning cleanup, part I. 1996-07-12 18:57:58 +00:00
scandir.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
scandir.c Remove trailing whitespace. 1995-05-30 05:51:47 +00:00
seed48.c Added *ran48 functions, and put them in the correct place this time. 1994-09-23 00:37:55 +00:00
seekdir.c General -Wall warning cleanup, part I. 1996-07-12 18:57:58 +00:00
semconfig.c Added SYSV ipc system calls. 1994-09-13 14:52:45 +00:00
semctl.c Added SYSV ipc system calls. 1994-09-13 14:52:45 +00:00
semget.c Added SYSV ipc system calls. 1994-09-13 14:52:45 +00:00
semop.c Added SYSV ipc system calls. 1994-09-13 14:52:45 +00:00
setdomainname.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
setflags.c Observe precedence set by Phillippe Charnier in adding an 1997-08-07 22:28:25 +00:00
setflagsbyname.c Observe precedence set by Phillippe Charnier in adding an 1997-08-07 22:28:25 +00:00
sethostname.c sethostname() returns int, not long. I could get used to having this 1996-12-05 18:27:20 +00:00
setjmp.3 Fixed a bunch of man page cross references that were 1996-02-15 20:07:05 +00:00
setjmperr.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
setmode.3 Merge from Lite2: man page updates 1997-03-11 11:47:52 +00:00
setmode.c Minor cleanup, mostly unused vars and missing #includes. 1995-10-22 14:37:11 +00:00
setproctitle.3 Add #include <sys/types.h> in synopsis, now required for libutil.h. 1997-05-11 08:50:33 +00:00
setproctitle.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
shmat.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
shmctl.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
shmdt.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
shmget.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
siginterrupt.3 Sort cross refereces in section SEE ALSO. 1997-09-29 19:11:55 +00:00
siginterrupt.c General -Wall warning cleanup, part I. 1996-07-12 18:57:58 +00:00
siglist.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
signal.3 Revert the previous prototype un-typo. Add a brief comment warning that 1997-09-28 17:11:31 +00:00
signal.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
sigsetops.3 Fixed #include and/or prototype bugs in synopsis. 1997-04-13 13:16:20 +00:00
sigsetops.c Oops! I accidently commited a change that wasn't ready for prime 1997-02-28 06:26:26 +00:00
sleep.3 Sort cross refereces in section SEE ALSO. 1997-09-29 19:11:55 +00:00
sleep.c Back out itimerfix hack since nanosleep1 fixed now 1997-08-13 18:13:17 +00:00
srand48.c Added *ran48 functions, and put them in the correct place this time. 1994-09-23 00:37:55 +00:00
stringlist.3 Add stringlist functions from NetBSD. (required for the new ftp(1) 1997-06-25 08:05:03 +00:00
stringlist.c _err() -> err(). 1997-06-29 00:33:17 +00:00
strtofflags.c Observe precedence set by Phillippe Charnier in adding an 1997-08-07 22:28:25 +00:00
sysconf.3 Make a note in the standards section that sysconf isn't completely 1996-12-27 03:39:03 +00:00
sysconf.c Include sys/time.h, not sys/user.h. 1995-12-08 08:47:41 +00:00
sysctl.3 Added HW_MACHINE_ARCH. 1997-08-30 02:26:36 +00:00
sysctl.c Minor cleanup, mostly unused vars and missing #includes. 1995-10-22 14:37:11 +00:00
sysctlbyname.c Have sysctlbyname() take a const first arg (the ascii string) 1997-07-12 11:14:30 +00:00
syslog.3 Fixed various problems: typos, grammer, missing include files 1996-05-23 01:05:25 +00:00
syslog.c Add backward compatibility so that static executables built on 1997-03-20 16:28:27 +00:00
tcgetpgrp.3 Show the real revision date and not the date that this 1997-06-23 04:03:49 +00:00
tcsendbreak.3 Show the real revision date and not the date that this 1997-06-23 04:03:49 +00:00
tcsetattr.3 Show the real revision date and not the date that this 1997-06-23 04:03:49 +00:00
tcsetpgrp.3 Show the real revision date and not the date that this 1997-06-23 04:03:49 +00:00
telldir.c Remove trailing whitespace. 1995-05-30 05:51:47 +00:00
termios.c Back out one of my previous changes: don't clear PARODD, 1996-03-28 13:33:18 +00:00
time.3 Removed bogus includes of <sys/types.h> from synopses. 1996-04-19 19:00:26 +00:00
time.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
times.3 Xref clocks(7). 1996-04-05 08:53:38 +00:00
times.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
timezone.3 Show the real revision date and not the date that this 1997-06-23 04:03:49 +00:00
timezone.c General -Wall warning cleanup, part I. 1996-07-12 18:57:58 +00:00
ttyname.3 Fixed inclomplete function type in synopsis. 1997-08-31 21:54:10 +00:00
ttyname.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
ttyslot.c General -Wall warning cleanup, part I. 1996-07-12 18:57:58 +00:00
tzset.3 Correctly use .Fn instead of .Nm to reference function names 1996-08-22 23:31:07 +00:00
ualarm.3 Sort cross refereces in section SEE ALSO. 1997-09-29 19:11:55 +00:00
ualarm.c Remove trailing whitespace. 1995-05-30 05:51:47 +00:00
uname.3 Show the real revision date and not the date that this 1997-06-23 04:03:49 +00:00
uname.c Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
unvis.3 Fixed #include and/or prototype bugs in synopsis. 1997-04-13 13:16:20 +00:00
unvis.c General -Wall warning cleanup, part I. 1996-07-12 18:57:58 +00:00
usleep.3 Sort cross refereces in section SEE ALSO. 1997-09-29 19:11:55 +00:00
usleep.c Oops, fix logic for previous commit 1997-08-14 06:46:44 +00:00
utime.3 Sort cross references. 1997-01-20 23:23:22 +00:00
utime.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
valloc.3 Fixed #include and/or prototype bugs in synopsis. 1997-04-19 15:57:20 +00:00
valloc.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
vis.3 Fixed #include and/or prototype bugs in synopsis. 1997-04-13 13:16:20 +00:00
vis.c General -Wall warning cleanup, part I. 1996-07-12 18:57:58 +00:00
wait3.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
wait.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
waitpid.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00