diff options
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/error_msg_and_die.c | 4 | ||||
-rw-r--r-- | libbb/fflush_stdout_and_exit.c | 2 | ||||
-rw-r--r-- | libbb/herror_msg_and_die.c | 2 | ||||
-rw-r--r-- | libbb/perror_msg_and_die.c | 2 | ||||
-rw-r--r-- | libbb/verror_msg.c | 5 | ||||
-rw-r--r-- | libbb/vinfo_msg.c | 2 | ||||
-rw-r--r-- | libbb/warn_ignoring_args.c | 2 | ||||
-rw-r--r-- | libbb/xfuncs.c | 3 |
8 files changed, 17 insertions, 5 deletions
diff --git a/libbb/error_msg_and_die.c b/libbb/error_msg_and_die.c index f25a1da..29a260b 100644 --- a/libbb/error_msg_and_die.c +++ b/libbb/error_msg_and_die.c @@ -13,6 +13,8 @@ #include <stdlib.h> #include "libbb.h" +int die_sleep; + void bb_error_msg_and_die(const char *s, ...) { va_list p; @@ -20,5 +22,7 @@ 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(bb_default_error_retval); } diff --git a/libbb/fflush_stdout_and_exit.c b/libbb/fflush_stdout_and_exit.c index 7e8152d..245f508 100644 --- a/libbb/fflush_stdout_and_exit.c +++ b/libbb/fflush_stdout_and_exit.c @@ -20,5 +20,7 @@ void bb_fflush_stdout_and_exit(int retval) if (fflush(stdout)) { retval = bb_default_error_retval; } + if (die_sleep) + sleep(die_sleep); exit(retval); } diff --git a/libbb/herror_msg_and_die.c b/libbb/herror_msg_and_die.c index 285b195..f115c8e 100644 --- a/libbb/herror_msg_and_die.c +++ b/libbb/herror_msg_and_die.c @@ -19,5 +19,7 @@ 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(bb_default_error_retval); } diff --git a/libbb/perror_msg_and_die.c b/libbb/perror_msg_and_die.c index 5b04640..c1cfb95 100644 --- a/libbb/perror_msg_and_die.c +++ b/libbb/perror_msg_and_die.c @@ -20,5 +20,7 @@ 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(bb_default_error_retval); } diff --git a/libbb/verror_msg.c b/libbb/verror_msg.c index d55da73..988a7a2 100644 --- a/libbb/verror_msg.c +++ b/libbb/verror_msg.c @@ -15,6 +15,7 @@ #include "libbb.h" int logmode = LOGMODE_STDIO; +const char *msg_eol = "\n"; void bb_verror_msg(const char *s, va_list p, const char* strerr) { @@ -28,9 +29,9 @@ void bb_verror_msg(const char *s, va_list p, const char* strerr) fprintf(stderr, "%s: ", bb_applet_name); vfprintf(stderr, s, p); if (!strerr) - fputc('\n', stderr); + fputs(msg_eol, stderr); else - fprintf(stderr, ": %s\n", strerr); + fprintf(stderr, ": %s%s", strerr, msg_eol); } if (ENABLE_FEATURE_SYSLOG && (logmode & LOGMODE_SYSLOG)) { if (!strerr) diff --git a/libbb/vinfo_msg.c b/libbb/vinfo_msg.c index 82fbda2..613b013 100644 --- a/libbb/vinfo_msg.c +++ b/libbb/vinfo_msg.c @@ -22,7 +22,7 @@ void bb_vinfo_msg(const char *s, va_list p) va_copy(p2, p); if (logmode & LOGMODE_STDIO) { vprintf(s, p); - putchar('\n'); + fputs(msg_eol, stdout); } if (ENABLE_FEATURE_SYSLOG && (logmode & LOGMODE_SYSLOG)) vsyslog(LOG_INFO, s, p2); diff --git a/libbb/warn_ignoring_args.c b/libbb/warn_ignoring_args.c index af82a6b..6405ff8 100644 --- a/libbb/warn_ignoring_args.c +++ b/libbb/warn_ignoring_args.c @@ -12,6 +12,6 @@ void bb_warn_ignoring_args(int n) { if (n) { - bb_perror_msg("ignoring all arguments"); + bb_error_msg("ignoring all arguments"); } } diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index 435379d..4bb05f2 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c @@ -408,7 +408,8 @@ char *xasprintf(const char *format, ...) void xprint_and_close_file(FILE *file) { // copyfd outputs error messages for us. - if (bb_copyfd_eof(fileno(file), 1) == -1) exit(bb_default_error_retval); + if (bb_copyfd_eof(fileno(file), 1) == -1) + exit(bb_default_error_retval); fclose(file); } |