aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2008-01-27 15:26:08 -0600
committerRob Landley <rob@landley.net>2008-01-27 15:26:08 -0600
commit12138e498721892320e703702dcd3a4b191fb7fc (patch)
tree4f31f3eb8f841bd9876d7a4358e92ac7861c2744 /lib
parent5c4a217cfbcb795a5ebc345a9efe9a1990801d1b (diff)
downloadtoybox-12138e498721892320e703702dcd3a4b191fb7fc.tar.gz
Teach perror_exit() to take a NULL argument when we just want "command: error".
Diffstat (limited to 'lib')
-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);
}