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.
This commit is contained in:
wchang0222%aol.com 2004-02-05 15:57:46 +00:00
Родитель 8e92c97aac
Коммит cea13d2580
1 изменённых файлов: 25 добавлений и 10 удалений

Просмотреть файл

@ -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;