From: H.G. Muller Date: Sat, 31 Mar 2012 13:23:30 +0000 (+0200) Subject: Fix switching debug option during session. X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=164666db4ca950b4f08dd424166ef6be3e3494c2;p=xboard.git Fix switching debug option during session. Switching on debug mode during the session did not create the requested debug file. --- 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