diff options
author | Rob Landley <rob@landley.net> | 2013-06-16 19:59:51 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2013-06-16 19:59:51 -0500 |
commit | 558303076c494519a2d4a1212f0a60e011662f42 (patch) | |
tree | 6b0440f7bbd7be9ef195794b95161aa71b88e62b /lib/lib.c | |
parent | c2305e895d92412761d5be258c2b73064a7061ed (diff) | |
download | toybox-558303076c494519a2d4a1212f0a60e011662f42.tar.gz |
Add xexit() and make error_exit() use it.
Diffstat (limited to 'lib/lib.c')
-rw-r--r-- | lib/lib.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -17,6 +17,12 @@ void xstrncpy(char *dest, char *src, size_t size) strcpy(dest, src); } +void xexit(void) +{ + if (toys.rebound) longjmp(*toys.rebound, 1); + else exit(toys.exitval); +} + void verror_msg(char *msg, int err, va_list va) { char *s = ": %s"; @@ -58,8 +64,7 @@ void error_exit(char *msg, ...) verror_msg(msg, 0, va); va_end(va); - if (toys.rebound) longjmp(*toys.rebound, 1); - else exit(toys.exitval); + xexit(); } @@ -72,8 +77,7 @@ void perror_exit(char *msg, ...) verror_msg(msg, errno, va); va_end(va); - if (toys.rebound) longjmp(*toys.rebound, 1); - else exit(toys.exitval); + xexit(); } // Die unless we can allocate memory. |