diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2018-05-19 02:39:37 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-05-28 17:12:22 +0800 |
commit | a332ebdaa13d3eaf70082e1be214c42645bc186a (patch) | |
tree | 36c11fa25bba3b35ef58578a307e8358cbd82c61 | |
parent | 0e6a3d20816365821fa9ff8f8c6d7bdf915ee3c8 (diff) | |
download | dash-a332ebdaa13d3eaf70082e1be214c42645bc186a.tar.gz |
exec: Return 126 on most errors in shellexec
Currently when shellexec fails on most errors the shell will exit
with exit status 2. This patch changes it to 126 in order to avoid
ambiguities with the exit status from a successful exec.
The errors that result in 127 has also been expanded to include
ENOTDIR, ENAMETOOLONG and ELOOP.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | src/exec.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -130,15 +130,15 @@ shellexec(char **argv, const char *path, int idx) /* Map to POSIX errors */ switch (e) { - case EACCES: + default: exerrno = 126; break; + case ELOOP: + case ENAMETOOLONG: case ENOENT: + case ENOTDIR: exerrno = 127; break; - default: - exerrno = 2; - break; } exitstatus = exerrno; TRACE(("shellexec failed for %s, errno %d, suppressint %d\n", |