aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-08-15 20:07:53 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-08-15 20:07:53 +0000
commitab9c44b1a41c9a17cd0f8a8f1e5517756ccb8bf0 (patch)
tree3a29ec44d7f37fc0a4e380531666413fa30d7e12
parentbb23c069191f18ed11b826371ed3571e214b41e3 (diff)
downloadbusybox-w32-ab9c44b1a41c9a17cd0f8a8f1e5517756ccb8bf0.tar.gz
busybox-w32-ab9c44b1a41c9a17cd0f8a8f1e5517756ccb8bf0.tar.bz2
busybox-w32-ab9c44b1a41c9a17cd0f8a8f1e5517756ccb8bf0.zip
v[hp]error_msg have 2-3 callsites only -> incorporate there.
-rw-r--r--include/libbb.h3
-rw-r--r--libbb/Kbuild2
-rw-r--r--libbb/herror_msg.c2
-rw-r--r--libbb/herror_msg_and_die.c2
-rw-r--r--libbb/perror_msg.c5
-rw-r--r--libbb/perror_msg_and_die.c5
-rw-r--r--libbb/vherror_msg.c15
-rw-r--r--libbb/vperror_msg.c15
-rw-r--r--libbb/xfuncs.c4
9 files changed, 6 insertions, 47 deletions
diff --git a/include/libbb.h b/include/libbb.h
index d60b410ae..6c6bec71e 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -649,15 +649,12 @@ extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1,
649extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); 649extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
650extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); 650extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
651extern void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); 651extern void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
652extern void bb_vherror_msg(const char *s, va_list p);
653extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); 652extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
654extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); 653extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
655extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN; 654extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN;
656extern void bb_perror_nomsg(void); 655extern void bb_perror_nomsg(void);
657extern void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); 656extern void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
658/* These are used internally -- you shouldn't need to use them */
659extern void bb_verror_msg(const char *s, va_list p, const char *strerr); 657extern void bb_verror_msg(const char *s, va_list p, const char *strerr);
660extern void bb_vperror_msg(const char *s, va_list p);
661 658
662 659
663/* applets which are useful from another applets */ 660/* applets which are useful from another applets */
diff --git a/libbb/Kbuild b/libbb/Kbuild
index 3ffda1240..1800bde8f 100644
--- a/libbb/Kbuild
+++ b/libbb/Kbuild
@@ -87,8 +87,6 @@ lib-y += uuencode.o
87lib-y += vdprintf.o 87lib-y += vdprintf.o
88lib-y += verror_msg.o 88lib-y += verror_msg.o
89lib-y += vfork_daemon_rexec.o 89lib-y += vfork_daemon_rexec.o
90lib-y += vherror_msg.o
91lib-y += vperror_msg.o
92lib-y += warn_ignoring_args.o 90lib-y += warn_ignoring_args.o
93lib-y += wfopen.o 91lib-y += wfopen.o
94lib-y += wfopen_input.o 92lib-y += wfopen_input.o
diff --git a/libbb/herror_msg.c b/libbb/herror_msg.c
index 943702c68..264690ba0 100644
--- a/libbb/herror_msg.c
+++ b/libbb/herror_msg.c
@@ -14,6 +14,6 @@ void bb_herror_msg(const char *s, ...)
14 va_list p; 14 va_list p;
15 15
16 va_start(p, s); 16 va_start(p, s);
17 bb_vherror_msg(s, p); 17 bb_verror_msg(s, p, hstrerror(h_errno));
18 va_end(p); 18 va_end(p);
19} 19}
diff --git a/libbb/herror_msg_and_die.c b/libbb/herror_msg_and_die.c
index 8c77378d7..894c80f38 100644
--- a/libbb/herror_msg_and_die.c
+++ b/libbb/herror_msg_and_die.c
@@ -14,7 +14,7 @@ void bb_herror_msg_and_die(const char *s, ...)
14 va_list p; 14 va_list p;
15 15
16 va_start(p, s); 16 va_start(p, s);
17 bb_vherror_msg(s, p); 17 bb_verror_msg(s, p, hstrerror(h_errno));
18 va_end(p); 18 va_end(p);
19 xfunc_die(); 19 xfunc_die();
20} 20}
diff --git a/libbb/perror_msg.c b/libbb/perror_msg.c
index 2ec1a9b2a..a958cff00 100644
--- a/libbb/perror_msg.c
+++ b/libbb/perror_msg.c
@@ -15,9 +15,6 @@ void bb_perror_msg(const char *s, ...)
15 15
16 va_start(p, s); 16 va_start(p, s);
17 /* Guard against "<error message>: Success" */ 17 /* Guard against "<error message>: Success" */
18 if (!errno) 18 bb_verror_msg(s, p, errno ? strerror(errno) : NULL);
19 bb_verror_msg(s, p, NULL);
20 else
21 bb_vperror_msg(s, p);
22 va_end(p); 19 va_end(p);
23} 20}
diff --git a/libbb/perror_msg_and_die.c b/libbb/perror_msg_and_die.c
index 90f56e04c..15f46fc05 100644
--- a/libbb/perror_msg_and_die.c
+++ b/libbb/perror_msg_and_die.c
@@ -15,10 +15,7 @@ void bb_perror_msg_and_die(const char *s, ...)
15 15
16 va_start(p, s); 16 va_start(p, s);
17 /* Guard against "<error message>: Success" */ 17 /* Guard against "<error message>: Success" */
18 if (!errno) 18 bb_verror_msg(s, p, errno ? strerror(errno) : NULL);
19 bb_verror_msg(s, p, NULL);
20 else
21 bb_vperror_msg(s, p);
22 va_end(p); 19 va_end(p);
23 xfunc_die(); 20 xfunc_die();
24} 21}
diff --git a/libbb/vherror_msg.c b/libbb/vherror_msg.c
deleted file mode 100644
index 04446a090..000000000
--- a/libbb/vherror_msg.c
+++ /dev/null
@@ -1,15 +0,0 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * Utility routines.
4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 */
9
10#include "libbb.h"
11
12void bb_vherror_msg(const char *s, va_list p)
13{
14 bb_verror_msg(s, p, hstrerror(h_errno));
15}
diff --git a/libbb/vperror_msg.c b/libbb/vperror_msg.c
deleted file mode 100644
index c3f79c23b..000000000
--- a/libbb/vperror_msg.c
+++ /dev/null
@@ -1,15 +0,0 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * Utility routines.
4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 */
9
10#include "libbb.h"
11
12void bb_vperror_msg(const char *s, va_list p)
13{
14 bb_verror_msg(s, p, strerror(errno));
15}
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index 4e17c28bd..64061e4f0 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -648,7 +648,7 @@ void ioctl_or_perror_and_die(int fd, int request, void *argp, const char *fmt,..
648 648
649 if (ioctl(fd, request, argp) < 0) { 649 if (ioctl(fd, request, argp) < 0) {
650 va_start(p, fmt); 650 va_start(p, fmt);
651 bb_vperror_msg(fmt, p); 651 bb_verror_msg(fmt, p, strerror(errno));
652 /* xfunc_die can actually longjmp, so be nice */ 652 /* xfunc_die can actually longjmp, so be nice */
653 va_end(p); 653 va_end(p);
654 xfunc_die(); 654 xfunc_die();
@@ -662,7 +662,7 @@ int ioctl_or_perror(int fd, int request, void *argp, const char *fmt,...)
662 662
663 if (ret < 0) { 663 if (ret < 0) {
664 va_start(p, fmt); 664 va_start(p, fmt);
665 bb_vperror_msg(fmt, p); 665 bb_verror_msg(fmt, p, strerror(errno));
666 va_end(p); 666 va_end(p);
667 } 667 }
668 return ret; 668 return ret;