aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormax99x <max99x@gmail.com>2011-07-31 06:30:28 +0300
committermax99x <max99x@gmail.com>2011-07-31 06:30:28 +0300
commitd1b71bb5fcecc251903306876d201a60e61ce5e6 (patch)
treeac46d185b9056c95c5d86ac59857971fb035d79b
parent17f137b38edfcf5b1ffecc6f99ffae115b08240c (diff)
Fixed a file offset incompatibility between read() and ungetc().
-rw-r--r--src/library.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/library.js b/src/library.js
index dcd1e22c..1a4dba67 100644
--- a/src/library.js
+++ b/src/library.js
@@ -1467,8 +1467,11 @@ LibraryManager.library = {
return -1;
}
} else {
+ var ungotSize = stream.ungotten.length;
bytesRead = _pread(fildes, buf, nbyte, stream.position);
- if (bytesRead != -1) stream.position += bytesRead;
+ if (bytesRead != -1) {
+ stream.position += (stream.ungotten.length - ungotSize) + bytesRead;
+ }
return bytesRead;
}
}