convert calloc to xzalloc
fix sleep-on-die option
diff --git a/libbb/error_msg_and_die.c b/libbb/error_msg_and_die.c
index 10d9535..7c5a4eb 100644
--- a/libbb/error_msg_and_die.c
+++ b/libbb/error_msg_and_die.c
@@ -15,6 +15,13 @@
int die_sleep;
+void sleep_and_die(void)
+{
+ if (die_sleep)
+ sleep(die_sleep);
+ exit(xfunc_error_retval);
+}
+
void bb_error_msg_and_die(const char *s, ...)
{
va_list p;
@@ -22,7 +29,5 @@
va_start(p, s);
bb_verror_msg(s, p, NULL);
va_end(p);
- if (die_sleep)
- sleep(die_sleep);
- exit(xfunc_error_retval);
+ sleep_and_die();
}