summaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
authorMatt Kraai2000-10-25 15:10:08 +0000
committerMatt Kraai2000-10-25 15:10:08 +0000
commit324a778f31ac99f2c9d947a99dc4c37902bde6fe (patch)
tree137420d5835bb40bc9712e895da5377c664bd4b3 /utility.c
parentb60208dd8fe3328a5db8be1dc958e62c9898a73b (diff)
downloadbusybox-324a778f31ac99f2c9d947a99dc4c37902bde6fe.zip
busybox-324a778f31ac99f2c9d947a99dc4c37902bde6fe.tar.gz
Added a fatalPerror function to simplify error handling.
Diffstat (limited to 'utility.c')
-rw-r--r--utility.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/utility.c b/utility.c
index c8a1820..39ed1b6 100644
--- a/utility.c
+++ b/utility.c
@@ -109,6 +109,23 @@ extern void fatalError(const char *s, ...)
exit(EXIT_FAILURE);
}
+extern void fatalPerror(const char *s, ...)
+{
+ va_list p;
+
+ va_start(p, s);
+ fflush(stdout);
+ fprintf(stderr, "%s: ", applet_name);
+ if (s && *s) {
+ vfprintf(stderr, s, p);
+ fputs(": ", stderr);
+ }
+ fprintf(stderr, "%s\n", strerror(errno));
+ va_end(p);
+ fflush(stderr);
+ exit(EXIT_FAILURE);
+}
+
#if defined BB_INIT
/* Returns kernel version encoded as major*65536 + minor*256 + patch,
* so, for example, to check if the kernel is greater than 2.2.11: