aboutsummaryrefslogtreecommitdiff
path: root/src/library.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-12-02 16:25:15 -0500
committerAlon Zakai <alonzakai@gmail.com>2013-12-02 16:25:15 -0500
commita327579fff22747e6854656dff43e71d11766289 (patch)
tree957c9b9d411cfc537814fe2af3cb9ce61418c9d6 /src/library.js
parenta42f659391fcbd0b85b29e5b8725b48a364eb20e (diff)
report better error in fread on bad stream
Diffstat (limited to 'src/library.js')
-rw-r--r--src/library.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/library.js b/src/library.js
index d6601077..26d766e9 100644
--- a/src/library.js
+++ b/src/library.js
@@ -2519,7 +2519,10 @@ LibraryManager.library = {
}
var bytesRead = 0;
var streamObj = FS.getStream(stream);
- if (!streamObj) return 0;
+ if (!streamObj) {
+ ___setErrNo(ERRNO_CODES.EBADF);
+ return 0;
+ }
while (streamObj.ungotten.length && bytesToRead > 0) {
{{{ makeSetValue('ptr++', '0', 'streamObj.ungotten.pop()', 'i8') }}}
bytesToRead--;