Commits (2)
......@@ -406,15 +406,18 @@ js_raw_read(JSContext *cx, uintN argc, jsval *arglist)
* required by POSIX.
*/
fflush(p->fp);
pos = ftell(p->fp);
fd = fileno(p->fp);
lseek(fd, pos, SEEK_SET);
len = read(fileno(p->fp),buf,len);
fseeko(p->fp, pos + (len >= 0 ? len : 0), SEEK_SET);
dbprintf(FALSE, p, "read %u raw bytes",len);
if(len<0)
len=0;
pos = ftello(p->fp);
if(pos < 0)
len = 0;
else {
fd = fileno(p->fp);
lseek(fd, pos, SEEK_SET);
len = read(fileno(p->fp),buf,len);
fseeko(p->fp, pos + (len >= 0 ? len : 0), SEEK_SET);
dbprintf(FALSE, p, "read %d raw bytes",len);
if(len<0)
len=0;
}
JS_RESUMEREQUEST(cx, rc);
str = JS_NewStringCopyN(cx, buf, len);
......
......@@ -3595,6 +3595,8 @@ bool getzpt(FILE* stream, fmsghdr_t* hdr)
bool intl_found = false;
pos=ftello(stream);
if(pos < 0)
return false;
len=fread(buf,1,0x1000,stream);
for(i=0;i<len;i++) {
if(buf[i]=='\n') /* ignore line-feeds */
......