From 95574e3f2a47291651f7c78c873318344565e80e Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 18 Mar 2019 20:37:53 -0700 Subject: cmp/env/nice/nohup/sort: use TOYFLAG_ARGFAIL. Also be a bit more consistent about `COMMAND [ARG...]` in usage text. --- toys/other/chroot.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'toys/other') 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); } -- cgit v1.2.3