diff options
author | dzwdz | 2023-02-25 18:40:31 +0100 |
---|---|---|
committer | dzwdz | 2023-02-25 18:40:31 +0100 |
commit | fc20b233a9fc6fa398ee046219c02ed6c15c442a (patch) | |
tree | 1d7d84fc69fcaaf9ce56a835cdb94222772696aa /src | |
parent | 1a1eb66fa0f4e6de6d06d80dae1bdce276fbd294 (diff) |
user/ext2fs: don't treat EOF as an error
Diffstat (limited to 'src')
-rw-r--r-- | src/user/app/ext2fs/main.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/user/app/ext2fs/main.c b/src/user/app/ext2fs/main.c index 678d189..12ef3bc 100644 --- a/src/user/app/ext2fs/main.c +++ b/src/user/app/ext2fs/main.c @@ -115,9 +115,13 @@ do_read(struct ext2 *fs, hid_t reqh, struct ufs_request *req, char *buf, size_t ext2_dropreq(fs, inode, false); void *b = ext2_req_file(fs, h->n, &req->capacity, req->offset); - if (!b) goto err; - _sys_fs_respond(reqh, b, req->capacity, 0); - ext2_dropreq(fs, b, false); + if (b) { + _sys_fs_respond(reqh, b, req->capacity, 0); + ext2_dropreq(fs, b, false); + } else if (req->capacity == 0) { + /* set by ext2_req_file on EOF */ + _sys_fs_respond(reqh, b, 0, 0); + } else goto err; } else { struct dirbuild db; char namebuf[257]; |