Fix a crash I caused with MSVC in OSD_SetLogFile(). Apparently, the behavior of setvbuf() when passed a NULL ptr for a buffer is actually left up to the implementation regarding what it does with the size parameter... DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4718 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2014-11-02 05:36:05 +00:00
parent fca06dc31c
commit 3c8034609f

View file

@ -812,16 +812,15 @@ void OSD_SetLogFile(const char *fn)
const int bufmode = _IOLBF;
#endif
if (osdlog)
{
Bfclose(osdlog);
osdlog = NULL;
}
MAYBE_FCLOSE_AND_NULL(osdlog);
if (fn) osdlog = Bfopen(fn,"w");
if (!fn)
return;
osdlog = Bfopen(fn, "w");
if (osdlog)
setvbuf(osdlog, (char *)NULL, bufmode, 0);
setvbuf(osdlog, (char *)NULL, bufmode, BUFSIZ);
}