$ ); echo $? echoed 0,all other shells echo 2.
[unix-history] / usr / src / bin / sh / main.c
index f8b3858..aa820e7 100644 (file)
@@ -15,7 +15,7 @@ static char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     8.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     8.5 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <stdio.h>
 #endif /* not lint */
 
 #include <stdio.h>
@@ -87,6 +87,8 @@ main(argc, argv)
                 * exception EXSHELLPROC to clean up before executing
                 * the shell procedure.
                 */
                 * exception EXSHELLPROC to clean up before executing
                 * the shell procedure.
                 */
+               if (exception == EXERROR)
+                       exitstatus = 2;
                if (exception == EXSHELLPROC) {
                        rootpid = getpid();
                        rootshell = 1;
                if (exception == EXSHELLPROC) {
                        rootpid = getpid();
                        rootshell = 1;