diff options
Diffstat (limited to 'libbb/perror_msg.c')
-rw-r--r-- | libbb/perror_msg.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libbb/perror_msg.c b/libbb/perror_msg.c index 6c8e1b51e..cbba805fb 100644 --- a/libbb/perror_msg.c +++ b/libbb/perror_msg.c | |||
@@ -6,7 +6,6 @@ | |||
6 | * | 6 | * |
7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
8 | */ | 8 | */ |
9 | |||
10 | #include "libbb.h" | 9 | #include "libbb.h" |
11 | 10 | ||
12 | void FAST_FUNC bb_perror_msg(const char *s, ...) | 11 | void FAST_FUNC bb_perror_msg(const char *s, ...) |
@@ -19,7 +18,23 @@ void FAST_FUNC bb_perror_msg(const char *s, ...) | |||
19 | va_end(p); | 18 | va_end(p); |
20 | } | 19 | } |
21 | 20 | ||
21 | void FAST_FUNC bb_perror_msg_and_die(const char *s, ...) | ||
22 | { | ||
23 | va_list p; | ||
24 | |||
25 | va_start(p, s); | ||
26 | /* Guard against "<error message>: Success" */ | ||
27 | bb_verror_msg(s, p, errno ? strerror(errno) : NULL); | ||
28 | va_end(p); | ||
29 | xfunc_die(); | ||
30 | } | ||
31 | |||
22 | void FAST_FUNC bb_simple_perror_msg(const char *s) | 32 | void FAST_FUNC bb_simple_perror_msg(const char *s) |
23 | { | 33 | { |
24 | bb_perror_msg("%s", s); | 34 | bb_perror_msg("%s", s); |
25 | } | 35 | } |
36 | |||
37 | void FAST_FUNC bb_simple_perror_msg_and_die(const char *s) | ||
38 | { | ||
39 | bb_perror_msg_and_die("%s", s); | ||
40 | } | ||