From 88816732b53eb536fe0e8db3d9ed15f0d1c29bb4 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Wed, 10 Jan 2024 00:47:09 -0500 Subject: more tests, a few fixes --- kernel/fs/tarfs.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'kernel/fs/tarfs.cpp') diff --git a/kernel/fs/tarfs.cpp b/kernel/fs/tarfs.cpp index 706280e..7ab0de5 100644 --- a/kernel/fs/tarfs.cpp +++ b/kernel/fs/tarfs.cpp @@ -48,6 +48,8 @@ namespace mercury::kernel::fs { //len <= 12 char buffer[12]; storage::io_result result = bd->read_bytes(offset, len, buffer); + if (result != storage::io_result::success) + return result; out = 0; for (size_t i = 0; i < len; ++i) { @@ -134,7 +136,7 @@ namespace mercury::kernel::fs { char full_name[255]; size_t full_name_len; - RETURN_MAYBE_NOT_FOUND(read_name(out, full_name, full_name_len)) + RETURN_MAYBE_NOT_FOUND(read_name(node, full_name, full_name_len)) if (full_name_len + name_len > 255) return storage::io_result::not_supported; @@ -150,11 +152,14 @@ namespace mercury::kernel::fs { size_t cand_name_len; RETURN_MAYBE_NOT_FOUND(read_name(out, cand_name, cand_name_len)) - if (cand_name_len != full_name_len) + if (cand_name_len != full_name_len && cand_name_len != full_name_len + 1) goto next_iter; for (size_t i = 0; i < full_name_len; ++i) if (cand_name[i] != full_name[i]) goto next_iter; + if (cand_name_len == full_name_len + 1 && + cand_name[full_name_len] != '/') + goto next_iter; return storage::io_result::success; -- cgit v1.2.3