fix bug in open
This commit is contained in:
parent
b230f1a451
commit
b6b6d42a89
1 changed files with 2 additions and 1 deletions
3
fs/fs.c
3
fs/fs.c
|
@ -79,7 +79,7 @@ int open_fs(fildes_t* file, const char* name)
|
||||||
if (name[0] == '/')
|
if (name[0] == '/')
|
||||||
file_node = fs_root;
|
file_node = fs_root;
|
||||||
|
|
||||||
while((name[j] != '\0') && (file_node != NULL)) {
|
while((name[j] != '\0') || ((file_node != NULL) && (file_node->type == FS_DIRECTORY))) {
|
||||||
i = 0;
|
i = 0;
|
||||||
while((name[j] != '/') && (name[j] != '\0')) {
|
while((name[j] != '/') && (name[j] != '\0')) {
|
||||||
fname[i] = name[j];
|
fname[i] = name[j];
|
||||||
|
@ -108,6 +108,7 @@ int open_fs(fildes_t* file, const char* name)
|
||||||
ret = dir_node->open(file, fname);
|
ret = dir_node->open(file, fname);
|
||||||
spinlock_unlock(&dir_node->lock);
|
spinlock_unlock(&dir_node->lock);
|
||||||
} else {
|
} else {
|
||||||
|
kprintf("KERNELERROR");
|
||||||
ret = -ENOENT;
|
ret = -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue