summaryrefslogtreecommitdiffstats
path: root/bin/sh/main.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2011-02-04 22:47:55 +0000
committerjilles <jilles@FreeBSD.org>2011-02-04 22:47:55 +0000
commit95ad413d4a493285a5560182fb10217819d7c357 (patch)
tree88fab75180accb5d4fe09924cbd01e047b9e4903 /bin/sh/main.c
parent88f7b7c78b4285a838792e26cf3806ab40f879d2 (diff)
downloadFreeBSD-src-95ad413d4a493285a5560182fb10217819d7c357.zip
FreeBSD-src-95ad413d4a493285a5560182fb10217819d7c357.tar.gz
sh: Remove special code for shell scripts without magic number.
These are called "shell procedures" in the source. If execve() failed with [ENOEXEC], the shell would reinitialize itself and execute the program as a script. This requires a fair amount of code which is not frequently used (most scripts have a #! magic number). Therefore just execute a new instance of sh (_PATH_BSHELL) to run the script.
Diffstat (limited to 'bin/sh/main.c')
-rw-r--r--bin/sh/main.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/bin/sh/main.c b/bin/sh/main.c
index 88483b0..c5de899 100644
--- a/bin/sh/main.c
+++ b/bin/sh/main.c
@@ -98,19 +98,7 @@ main(int argc, char *argv[])
(void) setlocale(LC_ALL, "");
state = 0;
if (setjmp(main_handler.loc)) {
- /*
- * When a shell procedure is executed, we raise the
- * exception EXSHELLPROC to clean up before executing
- * the shell procedure.
- */
switch (exception) {
- case EXSHELLPROC:
- rootpid = getpid();
- rootshell = 1;
- minusc = NULL;
- state = 3;
- break;
-
case EXEXEC:
exitstatus = exerrno;
break;
@@ -123,10 +111,8 @@ main(int argc, char *argv[])
break;
}
- if (exception != EXSHELLPROC) {
- if (state == 0 || iflag == 0 || ! rootshell)
- exitshell(exitstatus);
- }
+ if (state == 0 || iflag == 0 || ! rootshell)
+ exitshell(exitstatus);
reset();
if (exception == EXINT)
out2fmt_flush("\n");
OpenPOWER on IntegriCloud