summaryrefslogtreecommitdiff
path: root/kernel/fs/tarfs.cpp
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-01-10 00:47:09 -0500
committerBenji Dial <benji@benjidial.net>2024-01-10 00:47:09 -0500
commit88816732b53eb536fe0e8db3d9ed15f0d1c29bb4 (patch)
tree9dbc02f91158ce38ee59e6ae9b83f7888e193cd5 /kernel/fs/tarfs.cpp
parent15e62510104bc0e2b9180b66e5845d985cac03cc (diff)
downloadhilbert-os-88816732b53eb536fe0e8db3d9ed15f0d1c29bb4.tar.gz
more tests, a few fixes
Diffstat (limited to 'kernel/fs/tarfs.cpp')
-rw-r--r--kernel/fs/tarfs.cpp9
1 files changed, 7 insertions, 2 deletions
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;