Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Feb 2011 23:38:11 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r218242 - head/bin/sh
Message-ID:  <201102032338.p13NcBSh062221@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Thu Feb  3 23:38:11 2011
New Revision: 218242
URL: http://svn.freebsd.org/changeset/base/218242

Log:
  sh: Return only 126 or 127 for execve() failures.
  
  Do not return 2 for errors other than [EACCES] or [ENOENT].

Modified:
  head/bin/sh/exec.c

Modified: head/bin/sh/exec.c
==============================================================================
--- head/bin/sh/exec.c	Thu Feb  3 20:44:49 2011	(r218241)
+++ head/bin/sh/exec.c	Thu Feb  3 23:38:11 2011	(r218242)
@@ -129,20 +129,13 @@ shellexec(char **argv, char **envp, cons
 	}
 
 	/* Map to POSIX errors */
-	switch (e) {
-	case EACCES:
-		exerrno = 126;
-		break;
-	case ENOENT:
+	if (e == ENOENT || e == ENOTDIR) {
 		exerrno = 127;
-		break;
-	default:
-		exerrno = 2;
-		break;
-	}
-	if (e == ENOENT || e == ENOTDIR)
 		exerror(EXEXEC, "%s: not found", argv[0]);
-	exerror(EXEXEC, "%s: %s", argv[0], strerror(e));
+	} else {
+		exerrno = 126;
+		exerror(EXEXEC, "%s: %s", argv[0], strerror(e));
+	}
 }
 
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102032338.p13NcBSh062221>