aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-01-03 02:56:00 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-01-03 02:56:00 +0000
commit9b1381fd2fb7179f731709542507015799f90a51 (patch)
tree66b3617e0b6ceed9c3123000104df0d78bf9bf2a /libbb
parentbb3d0fab3b46d64e93687bc30b405d0878eca296 (diff)
downloadbusybox-9b1381fd2fb7179f731709542507015799f90a51.tar.gz
convert calloc to xzalloc
fix sleep-on-die option
Diffstat (limited to 'libbb')
-rw-r--r--libbb/error_msg_and_die.c11
-rw-r--r--libbb/fflush_stdout_and_exit.c7
-rw-r--r--libbb/herror_msg_and_die.c4
-rw-r--r--libbb/perror_msg_and_die.c4
4 files changed, 12 insertions, 14 deletions
diff --git a/libbb/error_msg_and_die.c b/libbb/error_msg_and_die.c
index 10d953513..7c5a4ebe9 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 @@ void bb_error_msg_and_die(const char *s, ...)
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();
}
diff --git a/libbb/fflush_stdout_and_exit.c b/libbb/fflush_stdout_and_exit.c
index 456ce9513..6f44770c6 100644
--- a/libbb/fflush_stdout_and_exit.c
+++ b/libbb/fflush_stdout_and_exit.c
@@ -15,10 +15,7 @@
void fflush_stdout_and_exit(int retval)
{
- if (fflush(stdout)) {
- retval = xfunc_error_retval;
- }
- if (die_sleep)
- sleep(die_sleep);
+ if (fflush(stdout))
+ sleep_and_die();
exit(retval);
}
diff --git a/libbb/herror_msg_and_die.c b/libbb/herror_msg_and_die.c
index f62ddd2ea..a7a22caf7 100644
--- a/libbb/herror_msg_and_die.c
+++ b/libbb/herror_msg_and_die.c
@@ -19,7 +19,5 @@ void bb_herror_msg_and_die(const char *s, ...)
va_start(p, s);
bb_vherror_msg(s, p);
va_end(p);
- if (die_sleep)
- sleep(die_sleep);
- exit(xfunc_error_retval);
+ sleep_and_die();
}
diff --git a/libbb/perror_msg_and_die.c b/libbb/perror_msg_and_die.c
index 2303ba211..7521e7157 100644
--- a/libbb/perror_msg_and_die.c
+++ b/libbb/perror_msg_and_die.c
@@ -20,7 +20,5 @@ void bb_perror_msg_and_die(const char *s, ...)
va_start(p, s);
bb_vperror_msg(s, p);
va_end(p);
- if (die_sleep)
- sleep(die_sleep);
- exit(xfunc_error_retval);
+ sleep_and_die();
}