From fc20b233a9fc6fa398ee046219c02ed6c15c442a Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sat, 25 Feb 2023 18:40:31 +0100 Subject: user/ext2fs: don't treat EOF as an error --- src/user/app/ext2fs/main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/user') 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]; -- cgit v1.2.3