From 164666db4ca950b4f08dd424166ef6be3e3494c2 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sat, 31 Mar 2012 15:23:30 +0200 Subject: [PATCH] Fix switching debug option during session. Switching on debug mode during the session did not create the requested debug file. --- menus.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/menus.c b/menus.c index 9d78f4c..f5e1885 100644 --- a/menus.c +++ b/menus.c @@ -431,6 +431,13 @@ void DebugProc () { appData.debugMode = !appData.debugMode; + if(!strcmp(appData.nameOfDebugFile, "stderr")) return; // stderr is already open, and should never be closed + if(!appData.debugMode) fclose(debugFP); + else { + debugFP = fopen(appData.nameOfDebugFile, "w"); + if(debugFP == NULL) debugFP = stderr; + else setbuf(debugFP, NULL); + } } void -- 1.7.0.4