From: Jim Meyering Date: Thu, 1 Aug 2002 09:19:24 +0000 (+0000) Subject: (run_shell): Exit with status 126 or 127 when execvp or X-Git-Tag: SH-UTILS-2_0_14~32 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d2b62daff5ce17691ecd36c1b48727212df34184;p=thirdparty%2Fcoreutils.git (run_shell): Exit with status 126 or 127 when execvp or execv fails, for consistency with POSIX commands like env and nice. --- diff --git a/src/su.c b/src/su.c index 65bb8b3fc5..3d834679ef 100644 --- a/src/su.c +++ b/src/su.c @@ -397,8 +397,12 @@ run_shell (const char *shell, const char *command, char **additional_args) args[argno++] = *additional_args; args[argno] = NULL; execv (shell, (char **) args); - error (0, errno, _("cannot run %s"), shell); - exit (1); + + { + int exit_status = (errno == ENOENT ? 127 : 126); + error (0, errno, "%s", shell); + exit (exit_status); + } } /* Return 1 if SHELL is a restricted shell (one not returned by