fix bug in open

This commit is contained in:
Marian Ohligs 2011-11-08 15:55:15 +01:00
parent b230f1a451
commit b6b6d42a89

View file

@ -79,7 +79,7 @@ int open_fs(fildes_t* file, const char* name)
if (name[0] == '/')
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;
while((name[j] != '/') && (name[j] != '\0')) {
fname[i] = name[j];
@ -108,6 +108,7 @@ int open_fs(fildes_t* file, const char* name)
ret = dir_node->open(file, fname);
spinlock_unlock(&dir_node->lock);
} else {
kprintf("KERNELERROR");
ret = -ENOENT;
}