ref: 2181395e50605ee0d0dad2baad317d87ffa62531
parent: 1a3a60b609e8a20d0ea2290027827f45384a0d97
author: Ori Bernstein <[email protected]>
date: Tue Dec 6 09:40:40 EST 2011
Don't fail at tokenizing big files. Actually append the read stuff to the end of the damn buffer.
--- a/parse/tok.c
+++ b/parse/tok.c
@@ -451,7 +451,6 @@
if (!t || t->type == TError)
fatal(line, "Unable to parse token starting with %c", c);
-
return t;
}
@@ -469,7 +468,7 @@
nread = 0;
fbuf = malloc(4096);
while (1) {
- n = read(fd, fbuf, 4096);
+ n = read(fd, fbuf + nread, 4096);
if (n < 0)
fatal(errno, "Error reading file %s", file);
if (n == 0)