summaryrefslogtreecommitdiff
path: root/src/chroot.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-08-01 08:50:19 +0000
committerJim Meyering <jim@meyering.net>2002-08-01 08:50:19 +0000
commita6005c2ba495a584d82fd812c8c0e702b97cb6d0 (patch)
tree5ce12f1e42f1990991dcac1106735c589ab6ea63 /src/chroot.c
parent2a41097fd7ec3697f6c8ca9b357c1225518bc36a (diff)
downloadcoreutils-a6005c2ba495a584d82fd812c8c0e702b97cb6d0.tar.xz
(main): Exit with status 126 or 127 when execvp or
execv fails, for consistency with POSIX commands like env and nice.
Diffstat (limited to 'src/chroot.c')
-rw-r--r--src/chroot.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/chroot.c b/src/chroot.c
index 760087587..4904c84d6 100644
--- a/src/chroot.c
+++ b/src/chroot.c
@@ -102,8 +102,10 @@ main (int argc, char **argv)
/* Execute the given command. */
execvp (argv[0], argv);
- error (1, errno, _("cannot execute %s"), argv[0]);
- exit (1);
- return 1;
+ {
+ int exit_status = (errno == ENOENT ? 127 : 126);
+ error (0, errno, "%s", argv[0]);
+ exit (exit_status);
+ }
}