diff options
author | Rob Landley <rob@landley.net> | 2015-08-06 07:39:23 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2015-08-06 07:39:23 -0500 |
commit | 9ce9399c01fd6aca688434dd2c552df2950a15cf (patch) | |
tree | 316b42361c0342625b4567f10071991e3e0d6489 | |
parent | 68986475982403b0dbc7c798d0a6e61c1a7be914 (diff) | |
download | toybox-9ce9399c01fd6aca688434dd2c552df2950a15cf.tar.gz toybox-9ce9399c01fd6aca688434dd2c552df2950a15cf.tar.bz2 toybox-9ce9399c01fd6aca688434dd2c552df2950a15cf.zip |
Adjust xexec() exit code to be 127, and tweaks for nommu friendliness.
-rw-r--r-- | lib/xwrap.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c index 54f2cbb..8086282 100644 --- a/lib/xwrap.c +++ b/lib/xwrap.c @@ -30,10 +30,10 @@ void xstrncat(char *dest, char *src, size_t size) void xexit(void) { + if (toys.rebound) longjmp(*toys.rebound, 1); if (fflush(NULL) || ferror(stdout)) if (!toys.exitval) perror_msg("write"); - if (toys.rebound) longjmp(*toys.rebound, 1); - else exit(toys.exitval); + exit(toys.exitval); } // Die unless we can allocate memory. @@ -136,7 +136,10 @@ void xexec(char **argv) if (CFG_TOYBOX && !CFG_TOYBOX_NORECURSE) toy_exec(argv); execvp(argv[0], argv); - perror_exit("exec %s", argv[0]); + perror_msg("exec %s", argv[0]); + toys.exitval = 127; + if (!CFG_TOYBOX_FORK) _exit(toys.exitval); + xexit(); } // Spawn child process, capturing stdin/stdout. |