aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/echo.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2019-08-04 16:17:37 -0500
committerRob Landley <rob@landley.net>2019-08-04 16:17:37 -0500
commit60dd7c8a794ed9f460d8ae9d3a6bba8e32494325 (patch)
tree78553a5fc775ac079228f95612c1b5f00156f726 /toys/posix/echo.c
parente5942a8c90c2f52550496fdf08efddb564d8e5a3 (diff)
downloadtoybox-60dd7c8a794ed9f460d8ae9d3a6bba8e32494325.tar.gz
Add TOYFLAG_MAYFORK and annotate a couple commands.
A TOYFLAG_NOFORK command must run in the context of toysh, but a MAYFORK can either run standalone or run in the toysh process. MAYFORK means it cleans up after itself: no leaked resources (malloc, mmap, filehandles, etc), even in error_exit() paths that would longjmp() back to the shell. It also doesn't discard anything we need to retain (don't close stdout, change toys.optargs[] so we can't free it, etc)...
Diffstat (limited to 'toys/posix/echo.c')
-rw-r--r--toys/posix/echo.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/echo.c b/toys/posix/echo.c
index 759990a3..94546ecd 100644
--- a/toys/posix/echo.c
+++ b/toys/posix/echo.c
@@ -9,7 +9,7 @@
* We also honor -- to _stop_ option parsing (bash doesn't, we go with
* consistency over compatibility here).
-USE_ECHO(NEWTOY(echo, "^?Een[-eE]", TOYFLAG_BIN))
+USE_ECHO(NEWTOY(echo, "^?Een[-eE]", TOYFLAG_BIN|TOYFLAG_MAYFORK))
config ECHO
bool "echo"