mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 06:38:37 -05:00
Argh. With DEBUG and MALLOC_LOG enabled, I found output intended for the
console was ending up in one or other of debug.log or putty_mem.log. I don't really understand why, but I've put some extra paranoia and caching in debug(()) and that seems to have fixed it (tm). Perhaps I can get back to debugging... [originally from svn r2291]
This commit is contained in:
parent
242a4872b9
commit
b3f2c9475e
12
misc.c
12
misc.c
@ -592,6 +592,7 @@ void safefree(void *ptr)
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static FILE *debug_fp = NULL;
|
static FILE *debug_fp = NULL;
|
||||||
|
static HANDLE debug_hdl = INVALID_HANDLE_VALUE;
|
||||||
static int debug_got_console = 0;
|
static int debug_got_console = 0;
|
||||||
|
|
||||||
static void dputs(char *buf)
|
static void dputs(char *buf)
|
||||||
@ -599,15 +600,18 @@ static void dputs(char *buf)
|
|||||||
DWORD dw;
|
DWORD dw;
|
||||||
|
|
||||||
if (!debug_got_console) {
|
if (!debug_got_console) {
|
||||||
AllocConsole();
|
if (AllocConsole()) {
|
||||||
debug_got_console = 1;
|
debug_got_console = 1;
|
||||||
|
debug_hdl = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!debug_fp) {
|
if (!debug_fp) {
|
||||||
debug_fp = fopen("debug.log", "w");
|
debug_fp = fopen("debug.log", "w");
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), buf, strlen(buf), &dw,
|
if (debug_hdl != INVALID_HANDLE_VALUE) {
|
||||||
NULL);
|
WriteFile(debug_hdl, buf, strlen(buf), &dw, NULL);
|
||||||
|
}
|
||||||
fputs(buf, debug_fp);
|
fputs(buf, debug_fp);
|
||||||
fflush(debug_fp);
|
fflush(debug_fp);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user