Introduce FEATURE_EXEC_PREFER_APPLETS = "re-execute our own

executable if we asked to exec someting with argv[0] == known_applet"
Use it in init. Also respect PATH in init, remove explicit "/sbin" etc
from exec. Patch by Gabriel L. Somlo <somlo@cmu.edu>
This commit is contained in:
Denis Vlasenko
2007-01-21 00:41:04 +00:00
parent b3f3c23f78
commit 2f0c0d0b88
5 changed files with 39 additions and 12 deletions

View File

@@ -6528,6 +6528,10 @@ setjobctl(int on)
int ofd;
ofd = fd = open(_PATH_TTY, O_RDWR);
if (fd < 0) {
/* BTW, bash will try to open(ttyname(0)) if open("/dev/tty") fails.
* That sometimes helps to acquire controlling tty.
* Obviously, a workaround for bugs when someone
* failed to provide a controlling tty to bash! :) */
fd += 3;
while (!isatty(fd) && --fd >= 0)
;