commit 8e2826b1d978341ddec1b4431ba2027e92a2353b
parent 4f4528290bcf47cac3d5fd6927e0d8c6ba86f37f
Author: Brian Swetland <swetland@frotz.net>
Date: Thu, 29 Aug 2013 16:28:33 -0700
io: increase buffer for error() and forgive stray newlines
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/common/io.cc b/common/io.cc
@@ -136,16 +136,20 @@ void printmtx(float *m, const char *name) {
}
int error(const char *fmt, ...) {
- char buf[128];
+ char buf[1024];
va_list ap;
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
- buf[127] = 0;
+ buf[1023] = 0;
#if defined(_WIN32) && !defined(_DEBUG)
MessageBox(NULL, buf, "Error", MB_OK);
#else
- printx("ERROR: %s\n", buf);
+ if (buf[0] && (buf[strlen(buf) - 1] == '\n')) {
+ printx("ERROR: %s", buf);
+ } else {
+ printx("ERROR: %s\n", buf);
+ }
#endif
return -1;
}