From aa83aa449ea4963f7cdc9ba462d866a6f5e9c3d2 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Sun, 15 Sep 2013 08:41:34 +0000 Subject: [PATCH] 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. --- src/sbbs3/js_file.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/sbbs3/js_file.c b/src/sbbs3/js_file.c index dbe2612172..0282c15da8 100644 --- a/src/sbbs3/js_file.c +++ b/src/sbbs3/js_file.c @@ -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); -- GitLab