diff options
author | max99x <max99x@gmail.com> | 2011-07-31 06:30:28 +0300 |
---|---|---|
committer | max99x <max99x@gmail.com> | 2011-07-31 06:30:28 +0300 |
commit | d1b71bb5fcecc251903306876d201a60e61ce5e6 (patch) | |
tree | ac46d185b9056c95c5d86ac59857971fb035d79b | |
parent | 17f137b38edfcf5b1ffecc6f99ffae115b08240c (diff) |
Fixed a file offset incompatibility between read() and ungetc().
-rw-r--r-- | src/library.js | 5 |
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; } } |