Commit aa83aa44 authored by rswindell's avatar rswindell
Browse files

Win32 kludge: if buffer size argument to File.open() (and thus setvbuf) is 1,

MS's CRTL throws an assertion. Buffer size must be >=2.
parent a6db2342
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2012 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2013 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -187,8 +187,13 @@ js_open(JSContext *cx, uintN argc, jsval *arglist)
dbprintf(FALSE, p, "opened: %s",p->name);
if(!bufsize)
setvbuf(p->fp,NULL,_IONBF,0); /* no buffering */
else
else {
#ifdef _WIN32
if(bufsize < 2)
bufsize = 2;
#endif
setvbuf(p->fp,NULL,_IOFBF,bufsize);
}
}
JS_RESUMEREQUEST(cx, rc);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment