lean up a potential error, thanks to Vladimir N. Oleynik <dzo@simtreas.ru>.
This commit is contained in:
parent
370fb08e79
commit
c73a7f9ba0
17
utility.c
17
utility.c
@ -79,8 +79,7 @@ const char mtab_file[] = "/dev/mtab";
|
|||||||
|
|
||||||
extern void usage(const char *usage)
|
extern void usage(const char *usage)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s\n\n", full_version);
|
fprintf(stderr, "%s\n\nUsage: %s\n", full_version, usage);
|
||||||
fprintf(stderr, "Usage: %s\n", usage);
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +88,6 @@ static void verror_msg(const char *s, va_list p)
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
fprintf(stderr, "%s: ", applet_name);
|
fprintf(stderr, "%s: ", applet_name);
|
||||||
vfprintf(stderr, s, p);
|
vfprintf(stderr, s, p);
|
||||||
fflush(stderr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void error_msg(const char *s, ...)
|
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)
|
static void vperror_msg(const char *s, va_list p)
|
||||||
{
|
{
|
||||||
fflush(stdout);
|
int err=errno;
|
||||||
fprintf(stderr, "%s: ", applet_name);
|
if(s == 0) s = "";
|
||||||
if (s && *s) {
|
verror_msg(s, p);
|
||||||
vfprintf(stderr, s, p);
|
if (*s) s = ": ";
|
||||||
fputs(": ", stderr);
|
fprintf(stderr, "%s%s\n", s, strerror(err));
|
||||||
}
|
|
||||||
fprintf(stderr, "%s\n", strerror(errno));
|
|
||||||
fflush(stderr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void perror_msg(const char *s, ...)
|
extern void perror_msg(const char *s, ...)
|
||||||
|
Loading…
Reference in New Issue
Block a user