Fixed -O double fclose (bug #1221)

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7083 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2019-02-12 00:05:28 +00:00
parent 2bdfe648f0
commit 788620866d
2 changed files with 6 additions and 2 deletions

View file

@ -16,6 +16,8 @@ ANSI targets are deprecated, consider moving to Unicode.
\b Added \R{loadandsetimage}{LoadAndSetImage}
\b Fixed -O stderr stream issue (\W{http://sf.net/p/nsis/bugs/1221}{bug #1221})
\S2{} Translations
\b Updated Hindi (\W{http://sf.net/p/nsis/patches/291}{patch #291}) and Portuguese (\W{http://sf.net/p/nsis/bugs/1219}{bug #1219})

View file

@ -70,8 +70,10 @@ static void myatexit()
{
dopause();
ResetPrintColor();
if (g_output != stdout && g_output) fclose(g_output), g_output = 0;
if (g_errout != stderr && g_errout) fclose(g_errout), g_errout = 0;
bool oneoutputstream = g_output == g_errout;
if (g_output != stdout && g_output ) fclose(g_output);
if (g_errout != stderr && g_errout && !oneoutputstream) fclose(g_errout);
g_output = g_errout = 0;
#ifdef _WIN32
SetConsoleOutputCP(g_wincon_orgoutcp);
#endif