diff options
author | Jim Meyering <jim@meyering.net> | 2002-08-01 09:19:24 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2002-08-01 09:19:24 +0000 |
commit | d2b62daff5ce17691ecd36c1b48727212df34184 (patch) | |
tree | 81cdb36a219be0760ca4d805c9e04c5a84dbfd21 /src | |
parent | a6005c2ba495a584d82fd812c8c0e702b97cb6d0 (diff) | |
download | coreutils-d2b62daff5ce17691ecd36c1b48727212df34184.tar.xz |
(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 'src')
-rw-r--r-- | src/su.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 |