Bugzilla bug 231195: fixed the crash in PR_LogCleanup if NSPR_LOG_FILE is

set to WinDebug.  Thanks to timeless@bemail.org for the patch. r=wtc.
Tag: NSPRPUB_PRE_4_2_CLIENT_BRANCH


git-svn-id: svn://10.0.0.236/branches/NSPRPUB_PRE_4_2_CLIENT_BRANCH@152372 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
wchang0222%aol.com
2004-02-05 15:56:22 +00:00
parent 93d3d4933d
commit db3e5d4a22

View File

@@ -269,7 +269,13 @@ void _PR_LogCleanup(void)
PR_LogFlush();
#ifdef _PR_USE_STDIO_FOR_LOGGING
if (logFile && logFile != stdout && logFile != stderr) {
if (logFile
&& logFile != stdout
&& logFile != stderr
#ifdef XP_PC
&& logFile != WIN32_DEBUG_FILE
#endif
) {
fclose(logFile);
}
#else
@@ -355,20 +361,29 @@ PR_IMPLEMENT(PRBool) PR_SetLogFile(const char *file)
#ifdef XP_PC
if ( strcmp( file, "WinDebug") == 0)
{
logFile = WIN32_DEBUG_FILE;
return(PR_TRUE);
newLogFile = WIN32_DEBUG_FILE;
}
else
#endif
newLogFile = fopen(file, "w");
if (newLogFile) {
{
newLogFile = fopen(file, "w");
if (!newLogFile)
return PR_FALSE;
/* We do buffering ourselves. */
setvbuf(newLogFile, NULL, _IONBF, 0);
if (logFile && logFile != stdout && logFile != stderr) {
fclose(logFile);
}
logFile = newLogFile;
}
return (PRBool) (newLogFile != 0);
if (logFile
&& logFile != stdout
&& logFile != stderr
#ifdef XP_PC
&& logFile != WIN32_DEBUG_FILE
#endif
) {
fclose(logFile);
}
logFile = newLogFile;
return PR_TRUE;
#else
PRFileDesc *newLogFile;