Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2000-10-25 19:10:08 +0400
committerMatt Kraai <kraai@debian.org>2000-10-25 19:10:08 +0400
commit324a778f31ac99f2c9d947a99dc4c37902bde6fe (patch)
tree137420d5835bb40bc9712e895da5377c664bd4b3 /utility.c
parentb60208dd8fe3328a5db8be1dc958e62c9898a73b (diff)
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 c8a1820d8..39ed1b66a 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: