# [PATCH] print warning/error/fatal messages in one shot

1 messages from 2007-11-09 to 2007-11-09. Participants: Nicolas Pitre.
Thread: https://gitlist.dev/t/10773

## Nicolas Pitre, 2007-11-09 19:33

Subject: [PATCH] print warning/error/fatal messages in one shot
Message-ID: <alpine.LFD.0.9999.0711091430330.21255@xanadu.home>
URL: https://gitlist.dev/e/alpine.LFD.0.9999.0711091430330.21255%40xanadu.home

```
Not doing so is likely to create a messed up display when sent over the 
sideband protocol.

Signed-off-by: Nicolas Pitre <nico@cam.org>
---
diff --git a/usage.c b/usage.c
index f5e652c..a5fc4ec 100644
--- a/usage.c
+++ b/usage.c
@@ -7,9 +7,9 @@
 
 static void report(const char *prefix, const char *err, va_list params)
 {
-	fputs(prefix, stderr);
-	vfprintf(stderr, err, params);
-	fputs("\n", stderr);
+	char msg[256];
+	vsnprintf(msg, sizeof(msg), err, params);
+	fprintf(stderr, "%s%s\n", prefix, msg);
 }
 
 static NORETURN void usage_builtin(const char *err)

```
