Skip to content
Snippets Groups Projects
Commit d0ebcb59 authored by rswindell's avatar rswindell
Browse files

Eliminate MSVC10 assertion in fdopen() when passed a mode string with an

unsupported mode char in it (e.g. 'e'), i.e. from load/lockfile.js.
parent e386ba2a
No related branches found
No related tags found
No related merge requests found
...@@ -169,7 +169,10 @@ js_open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) ...@@ -169,7 +169,10 @@ js_open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
p->fp=fopen(p->name,p->mode); p->fp=fopen(p->name,p->mode);
else { else {
if((file=nopen(p->name,fopenflags(p->mode)))!=-1) { if((file=nopen(p->name,fopenflags(p->mode)))!=-1) {
if((p->fp=fdopen(file,p->mode))==NULL) char fdomode[4];
SAFECOPY(fdomode,p->mode);
fdomode[strspn(fdomode,"abrwt+")]=0; /* MSVC10 fdopen() asserts when passed a mode with an unsupported char (e.g. 'e') */
if((p->fp=fdopen(file,fdomode))==NULL)
close(file); close(file);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment