fix(iso): wrong register of non-directories

This commit is contained in:
aliamelo committed 2022-04-24 02:29:26 +02:00
1 parent b2eb2df8e9
commit 525739572f
2 files changed
+4 -5

No files matched your search

+1 -1
View File
@@ -19,7 +19,7 @@ int register_fd(u32 lba, u32 file_size, u8 is_dir)
if (free_fd < 0)
return -1;
struct file_entry f = { 0, lba, 0, file_size, is_dir };
struct file_entry f = { 1, lba, 0, file_size, is_dir };
fd_table[free_fd] = f;
return free_fd;
}
+3 -4
View File
@@ -49,10 +49,7 @@ int open(const char *pathname, int flags)
// we found the file
if (!length)
{
return register_fd(curr->data_blk.le, curr->file_size.le,
(curr->type == ISO_FILE_ISDIR));
}
return register_fd(curr->data_blk.le, curr->file_size.le, 1);
// iteration for one directory
while (curr->dir_size != 0)
@@ -60,6 +57,8 @@ int open(const char *pathname, int flags)
if (length == curr->idf_len &&
!strncmp(pathname + start, curr->idf, length))
{
if (!(curr->type & ISO_FILE_ISDIR))
return register_fd(curr->data_blk.le, curr->file_size.le, 0);
curr = read_block(curr->data_blk.le);
found = 1;
break;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.