diff options
author | Jim Meyering | 2002-08-01 11:19:24 +0200 |
---|---|---|
committer | Jim Meyering | 2002-08-01 11:19:24 +0200 |
commit | 9fa7b2b0127205dae37f18e915196e2c39e09e4c (patch) | |
tree | 212f78d3aa674f1db75aed5fe7913173e8b2c13f /login-utils/su.c | |
parent | (usage): Use the PACKAGE_BUGREPORT e-mail address, rather than hard-coding it. (diff) | |
download | kernel-qcow2-util-linux-9fa7b2b0127205dae37f18e915196e2c39e09e4c.tar.gz kernel-qcow2-util-linux-9fa7b2b0127205dae37f18e915196e2c39e09e4c.tar.xz kernel-qcow2-util-linux-9fa7b2b0127205dae37f18e915196e2c39e09e4c.zip |
(run_shell): Exit with status 126 or 127 when execvp or
execv fails, for consistency with POSIX commands like env and nice.
Diffstat (limited to 'login-utils/su.c')
-rw-r--r-- | login-utils/su.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/login-utils/su.c b/login-utils/su.c index 65bb8b3fc..3d834679e 100644 --- a/login-utils/su.c +++ b/login-utils/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 |