summaryrefslogtreecommitdiffhomepage
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)
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";
extern void usage(const char *usage)
{
- fprintf(stderr, "%s\n\n", full_version);
- fprintf(stderr, "Usage: %s\n", usage);
+ fprintf(stderr, "%s\n\nUsage: %s\n", full_version, usage);
exit(EXIT_FAILURE);
}
@@ -89,7 +88,6 @@ static void verror_msg(const char *s, va_list p)
fflush(stdout);
fprintf(stderr, "%s: ", applet_name);
vfprintf(stderr, s, p);
- fflush(stderr);
}
extern void error_msg(const char *s, ...)
@@ -113,14 +111,11 @@ extern void error_msg_and_die(const char *s, ...)
static void vperror_msg(const char *s, va_list p)
{
- fflush(stdout);
- fprintf(stderr, "%s: ", applet_name);
- if (s && *s) {
- vfprintf(stderr, s, p);
- fputs(": ", stderr);
- }
- fprintf(stderr, "%s\n", strerror(errno));
- fflush(stderr);
+ int err=errno;
+ if(s == 0) s = "";
+ verror_msg(s, p);
+ if (*s) s = ": ";
+ fprintf(stderr, "%s%s\n", s, strerror(err));
}
extern void perror_msg(const char *s, ...)