Commit 73a864c51c35102beba05aa5d36cabb220ae8664

Con Kolivas 2011-07-11T21:56:34

vfprintf invalidates the va args so do it after the curses output.

diff --git a/main.c b/main.c
index 00e3369..a3722ae 100644
--- a/main.c
+++ b/main.c
@@ -601,7 +601,7 @@ void log_curses(const char *f, va_list ap)
 
 	if (unlikely(!curses_active))
 		return;
-	vwprintw(mainwin, f, ap);
+	vw_printw(mainwin, f, ap);
 	clrtoeol();
 	getyx(mainwin, logcursor, x);
 
diff --git a/util.c b/util.c
index 9077754..ef68039 100644
--- a/util.c
+++ b/util.c
@@ -90,12 +90,12 @@ void vapplog(int prio, const char *fmt, va_list ap)
 			tm.tm_min,
 			tm.tm_sec,
 			fmt);
+		log_curses(f, ap);
 		/* Only output to stderr if it's not going to the screen as well */
 		if (opt_log_output && !isatty(fileno((FILE *)stderr))) {
 			vfprintf(stderr, f, ap);	/* atomic write to stderr */
 			fflush(stderr);
 		}
-		log_curses(f, ap);
 	}
 }