diff options
Diffstat (limited to 'lib/xwrap.c')
-rwxr-xr-x[-rw-r--r--] | lib/xwrap.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c index 8086282..54f2cbb 100644..100755 --- 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"); - exit(toys.exitval); + if (toys.rebound) longjmp(*toys.rebound, 1); + else exit(toys.exitval); } // Die unless we can allocate memory. @@ -136,10 +136,7 @@ void xexec(char **argv) if (CFG_TOYBOX && !CFG_TOYBOX_NORECURSE) toy_exec(argv); execvp(argv[0], argv); - perror_msg("exec %s", argv[0]); - toys.exitval = 127; - if (!CFG_TOYBOX_FORK) _exit(toys.exitval); - xexit(); + perror_exit("exec %s", argv[0]); } // Spawn child process, capturing stdin/stdout. |