diff --git a/k/fd.c b/k/fd.c index 5aae201..35e49ac 100644 --- a/k/fd.c +++ b/k/fd.c @@ -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; } diff --git a/k/iso.c b/k/iso.c index 76fffa9..f9f6961 100644 --- a/k/iso.c +++ b/k/iso.c @@ -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;