summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/error.h1
-rw-r--r--src/exec.c3
-rw-r--r--src/main.c4
3 files changed, 2 insertions, 6 deletions
diff --git a/src/error.h b/src/error.h
index 2db9fe6..7b04634 100644
--- a/src/error.h
+++ b/src/error.h
@@ -66,7 +66,6 @@ struct jmploc {
 
 extern struct jmploc *handler;
 extern int exception;
-extern int exerrno;	/* error for EXEXEC */
 
 /* exceptions */
 #define EXINT 0		/* SIGINT received */
diff --git a/src/exec.c b/src/exec.c
index 1a4a9a3..f43108e 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -100,7 +100,6 @@ struct tblentry {
 
 STATIC struct tblentry *cmdtable[CMDTABLESIZE];
 STATIC int builtinloc = -1;		/* index in path of %builtin, or -1 */
-int exerrno;				/* Last exec error */
 
 
 STATIC void tryexec(char *, char **, char **);
@@ -123,6 +122,7 @@ shellexec(char **argv, const char *path, int idx)
 	char *cmdname;
 	int e;
 	char **envp;
+	int exerrno;
 
 	clearredir(1);
 	envp = environment();
@@ -153,6 +153,7 @@ shellexec(char **argv, const char *path, int idx)
 		exerrno = 2;
 		break;
 	}
+	exitstatus = exerrno;
 	TRACE(("shellexec failed for %s, errno %d, suppressint %d\n",
 		argv[0], e, suppressint ));
 	exerror(EXEXEC, "%s: %s", argv[0], errmsg(e, E_EXEC));
diff --git a/src/main.c b/src/main.c
index 9b5a409..c686a13 100644
--- a/src/main.c
+++ b/src/main.c
@@ -132,10 +132,6 @@ main(int argc, char **argv)
 
 		e = exception;
 		switch (exception) {
-		case EXEXEC:
-			status = exerrno;
-			break;
-
 		case EXERROR:
 			status = 2;
 			break;