aboutsummaryrefslogtreecommitdiff
path: root/toys/other
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-03-18 20:37:53 -0700
committerRob Landley <rob@landley.net>2019-03-18 23:37:05 -0500
commit95574e3f2a47291651f7c78c873318344565e80e (patch)
treee3ff1282473f9f0724770fec64b2a4b3457364e2 /toys/other
parent7709875b443fcd155e1737f18d3fff75c4b2753a (diff)
downloadtoybox-95574e3f2a47291651f7c78c873318344565e80e.tar.gz
cmp/env/nice/nohup/sort: use TOYFLAG_ARGFAIL.
Also be a bit more consistent about `COMMAND [ARG...]` in usage text.
Diffstat (limited to 'toys/other')
-rw-r--r--toys/other/chroot.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/toys/other/chroot.c b/toys/other/chroot.c
index b6ef17d6..d791f34a 100644
--- a/toys/other/chroot.c
+++ b/toys/other/chroot.c
@@ -7,13 +7,13 @@
* The container guys use pivot_root() to deal with this, which does actually
* edit mount tree. (New option? Kernel patch?)
-USE_CHROOT(NEWTOY(chroot, "^<1", TOYFLAG_USR|TOYFLAG_SBIN))
+USE_CHROOT(NEWTOY(chroot, "^<1", TOYFLAG_USR|TOYFLAG_SBIN|TOYFLAG_ARGFAIL(125)))
config CHROOT
bool "chroot"
default y
help
- usage: chroot NEWPATH [commandline...]
+ usage: chroot NEWROOT [COMMAND [ARG...]]
Run command within a new root directory. If no command, run /bin/sh.
*/
@@ -24,7 +24,10 @@ void chroot_main(void)
{
char *binsh[] = {"/bin/sh", "-i", 0};
- if (chdir(*toys.optargs) || chroot(".")) perror_exit_raw(*toys.optargs);
+ if (chdir(*toys.optargs) || chroot(".")) {
+ toys.exitval = 125;
+ perror_exit_raw(*toys.optargs);
+ }
if (toys.optargs[1]) xexec(toys.optargs+1);
else xexec(binsh);
}