aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-01-20 21:41:11 +0000
committerEric Andersen <andersen@codepoet.org>2001-01-20 21:41:11 +0000
commitc73a7f9ba0079e03c1376409184d416b0e36ea49 (patch)
treed1b1a9d58307fdf2d41b629cc454741cddfb2bf7
parent370fb08e799111e40456990bb088819cbd80b492 (diff)
downloadbusybox-w32-c73a7f9ba0079e03c1376409184d416b0e36ea49.tar.gz
busybox-w32-c73a7f9ba0079e03c1376409184d416b0e36ea49.tar.bz2
busybox-w32-c73a7f9ba0079e03c1376409184d416b0e36ea49.zip
lean up a potential error, thanks to Vladimir N. Oleynik <dzo@simtreas.ru>.
-rw-r--r--utility.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/utility.c b/utility.c
index 3d5620ec5..27613b177 100644
--- a/utility.c
+++ b/utility.c
@@ -79,8 +79,7 @@ const char mtab_file[] = "/dev/mtab";
79 79
80extern void usage(const char *usage) 80extern void usage(const char *usage)
81{ 81{
82 fprintf(stderr, "%s\n\n", full_version); 82 fprintf(stderr, "%s\n\nUsage: %s\n", full_version, usage);
83 fprintf(stderr, "Usage: %s\n", usage);
84 exit(EXIT_FAILURE); 83 exit(EXIT_FAILURE);
85} 84}
86 85
@@ -89,7 +88,6 @@ static void verror_msg(const char *s, va_list p)
89 fflush(stdout); 88 fflush(stdout);
90 fprintf(stderr, "%s: ", applet_name); 89 fprintf(stderr, "%s: ", applet_name);
91 vfprintf(stderr, s, p); 90 vfprintf(stderr, s, p);
92 fflush(stderr);
93} 91}
94 92
95extern void error_msg(const char *s, ...) 93extern void error_msg(const char *s, ...)
@@ -113,14 +111,11 @@ extern void error_msg_and_die(const char *s, ...)
113 111
114static void vperror_msg(const char *s, va_list p) 112static void vperror_msg(const char *s, va_list p)
115{ 113{
116 fflush(stdout); 114 int err=errno;
117 fprintf(stderr, "%s: ", applet_name); 115 if(s == 0) s = "";
118 if (s && *s) { 116 verror_msg(s, p);
119 vfprintf(stderr, s, p); 117 if (*s) s = ": ";
120 fputs(": ", stderr); 118 fprintf(stderr, "%s%s\n", s, strerror(err));
121 }
122 fprintf(stderr, "%s\n", strerror(errno));
123 fflush(stderr);
124} 119}
125 120
126extern void perror_msg(const char *s, ...) 121extern void perror_msg(const char *s, ...)