Fixed bug with shared log file references

This commit is contained in:
Mark Pizzolato 2011-04-18 16:06:19 -07:00
parent 94ad4e303f
commit bafbba4df8

View file

@ -540,7 +540,6 @@ t_stat sim_open_logfile (char *filename, t_bool binary, FILE **pf, FILEREF **pre
{ {
char *tptr, gbuf[CBUFSIZE]; char *tptr, gbuf[CBUFSIZE];
*pref = NULL;
if ((filename == NULL) || (*filename == 0)) /* too few arguments? */ if ((filename == NULL) || (*filename == 0)) /* too few arguments? */
return SCPE_2FARG; return SCPE_2FARG;
tptr = get_glyph (filename, gbuf, 0); tptr = get_glyph (filename, gbuf, 0);
@ -564,10 +563,14 @@ else if (strcmp (gbuf, "DEBUG") == 0) { /* output to debug? */
if (*pref) if (*pref)
++(*pref)->refcount; ++(*pref)->refcount;
} }
else if (strcmp (gbuf, "STDOUT") == 0) /* output to stdout? */ else if (strcmp (gbuf, "STDOUT") == 0) { /* output to stdout? */
*pf = stdout; *pf = stdout;
else if (strcmp (gbuf, "STDERR") == 0) /* output to stderr? */ *pref = NULL;
}
else if (strcmp (gbuf, "STDERR") == 0) { /* output to stderr? */
*pf = stderr; *pf = stderr;
*pref = NULL;
}
else { else {
*pref = calloc (1, sizeof(**pref)); *pref = calloc (1, sizeof(**pref));
if (!*pref) if (!*pref)