git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] print warning/error/fatal messages in one shot
@ 2007-11-09 19:33 Nicolas Pitre
  0 siblings, 0 replies; only message in thread
From: Nicolas Pitre @ 2007-11-09 19:33 UTC (permalink / raw
  To: Junio C Hamano; +Cc: git

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)

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-11-09 19:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-09 19:33 [PATCH] print warning/error/fatal messages in one shot Nicolas Pitre

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).