aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/lib.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 1fadfb7b..71abc3ae 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -20,9 +20,12 @@ void xstrcpy(char *dest, char *src, size_t size)
void verror_msg(char *msg, int err, va_list va)
{
+ char *s = ": %s";
+
fprintf(stderr, "%s: ", toys.which->name);
- vfprintf(stderr, msg, va);
- if (err) fprintf(stderr, ": %s", strerror(err));
+ if (msg) vfprintf(stderr, msg, va);
+ else s+=2;
+ if (err) fprintf(stderr, s, strerror(err));
putc('\n', stderr);
}