Add xexit() and make error_exit() use it.
diff --git a/lib/lib.c b/lib/lib.c
index af820e2..dca92cb 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -17,6 +17,12 @@
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 @@
verror_msg(msg, 0, va);
va_end(va);
- if (toys.rebound) longjmp(*toys.rebound, 1);
- else exit(toys.exitval);
+ xexit();
}
@@ -72,8 +77,7 @@
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.