diff --git a/TODO.md b/TODO.md index a67754c..8c3ab9a 100644 --- a/TODO.md +++ b/TODO.md @@ -1,5 +1,6 @@ # For MVP functionality +- write a tester OS, basically a menu with tests to run - stop doing linear scans and do hashmaps smh (ls /dev is awfully slow and this MIGHT be why) - volatile filesystem - device info diff --git a/data/drive.img b/data/drive.img deleted file mode 100644 index c97c12f..0000000 Binary files a/data/drive.img and /dev/null differ diff --git a/src/main.c b/src/main.c index 6d69684..8d8727c 100644 --- a/src/main.c +++ b/src/main.c @@ -200,7 +200,12 @@ nn_Exit ne_fsState_handler(nn_FilesystemRequest *req) { if(feof(f)) { req->strarg1 = NULL; } else { - req->strarg1len = fread(req->strarg1, sizeof(char), req->strarg1len, f); + size_t off = 0; + while(off < req->strarg1len) { + if(feof(f)) break; + off += fread(req->strarg1 + off, sizeof(char), req->strarg1len - off, f); + } + req->strarg1len = off; } return NN_OK; case NN_FS_WRITE: diff --git a/src/neonucleus.c b/src/neonucleus.c index d237de3..820e0ea 100644 --- a/src/neonucleus.c +++ b/src/neonucleus.c @@ -2718,7 +2718,9 @@ nn_Exit nn_filesystem_handler(nn_ComponentRequest *req) { if(nn_checkinteger(computer, 0, "bad argument #1 (integer expected)")) return NN_EBADCALL; fsreq.fd = nn_tointeger(computer, 0); fsreq.action = NN_FS_CLOSE; - return state->handler(&fsreq); + err = state->handler(&fsreq); + if(err) return err; + return nn_pushbool(computer, true); } if(method == NN_FSNUM_READ) { nn_costComponent(computer, req->compAddress, state->fs.readsPerTick);