ram_fs: fix recursive 'lookup_and_lock()' calls

With this patch the 'Directory::lookup_and_lock()' function passes its
'return_parent' argument to recursive calls of itself.

Fixes #306.
This commit is contained in:
Christian Prochaska 2012-07-31 19:44:59 +02:00 committed by Norman Feske
parent 4caaba64c3
commit d6d45f870e
2 changed files with 5 additions and 1 deletions

View File

@ -43,6 +43,7 @@ int main(int argc, char *argv[])
ssize_t count;
char const *dir_name = "/testdir";
char const *dir_name2 = "testdir2";
char const *file_name = "test.tst";
char const *file_name2 = "test2.tst";
char const *file_name3 = "test3.tst";
@ -64,6 +65,9 @@ int main(int argc, char *argv[])
/* change to new directory */
CALL_AND_CHECK(ret, chdir(dir_name), ret == 0, "dir_name=%s", dir_name);
/* create subdirectory with relative path */
CALL_AND_CHECK(ret, mkdir(dir_name2, 0777), ((ret == 0) || (errno == EEXIST)), "dir_name=%s", dir_name2);
/* write pattern to a file */
CALL_AND_CHECK(fd, open(file_name, O_CREAT | O_WRONLY), fd >= 0, "file_name=%s", file_name);
CALL_AND_CHECK(count, write(fd, pattern, pattern_size), (size_t)count == pattern_size, "");

View File

@ -114,7 +114,7 @@ namespace File_system {
if (!sub_dir)
throw Lookup_failed();
return sub_dir->lookup_and_lock(path + i + 1);
return sub_dir->lookup_and_lock(path + i + 1, return_parent);
}
Directory *lookup_and_lock_dir(char const *path)