diff options
author | Anthony Pesch <inolen@gmail.com> | 2013-08-27 23:43:56 -0700 |
---|---|---|
committer | Anthony Pesch <inolen@gmail.com> | 2013-08-29 12:57:33 -0700 |
commit | fe3533636b24c23fb904f3ca94425003c0565177 (patch) | |
tree | 23ab00295c6a18f00c01690c50de9f53649d6e84 /src/library.js | |
parent | 4d41dc3fa572f89249749c4b7a37864c99018004 (diff) |
- added tests for tcgetattr / tcsetattr
- made test_stdin async to work in the node environment
- clearerr should reset both eof and error indicators
- fgetc was incorrectly setting the eof indicator. in cases where fread had errored with EAGAIN it was setting eof. I removed the set entirely, as there is no need for fgetc to even worry about it, fread will set the correct value in any case
Diffstat (limited to 'src/library.js')
-rw-r--r-- | src/library.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/library.js b/src/library.js index f0a4f53a..f6b3d5ef 100644 --- a/src/library.js +++ b/src/library.js @@ -2261,7 +2261,11 @@ LibraryManager.library = { // void clearerr(FILE *stream); // http://pubs.opengroup.org/onlinepubs/000095399/functions/clearerr.html stream = FS.getStream(stream); - if (stream) stream.error = false; + if (!stream) { + return; + } + stream.eof = false; + stream.error = false; }, fclose__deps: ['close', 'fsync'], fclose: function(stream) { @@ -2322,7 +2326,6 @@ LibraryManager.library = { if (streamObj.eof || streamObj.error) return -1; var ret = _fread(_fgetc.ret, 1, 1, stream); if (ret == 0) { - streamObj.eof = true; return -1; } else if (ret == -1) { streamObj.error = true; |