rump_fs: handle errors on mkdir correctly

This commit is contained in:
Christian Helmuth 2017-03-23 17:59:25 +01:00
parent 7ff2927edb
commit 92a339befd
3 changed files with 16 additions and 7 deletions

View File

@ -65,12 +65,11 @@ append config {
<start name="test-libc_vfs">
<resource name="RAM" quantum="4M"/>
<config>
<libc stdout="/dev/log">
<vfs>
<dir name="dev"> <log/> </dir>
<fs/>
</vfs>
</libc>
<vfs>
<dir name="dev"> <log/> </dir>
<fs/>
</vfs>
<libc stdout="/dev/log"/>
</config>
</start>
</config>}

View File

@ -50,7 +50,14 @@ class File_system::Directory : public Node
mode_t ugo = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
ret = rump_sys_mkdir(path, ugo);
if (ret == -1)
throw No_space();
switch (errno) {
case ENAMETOOLONG: throw Name_too_long();
case EACCES: throw Permission_denied();
case ENOENT: throw Lookup_failed();
case EEXIST: throw Node_already_exists();
case ENOSPC:
default: throw No_space();
}
}
struct stat s;

View File

@ -119,6 +119,9 @@ static void test(Genode::Xml_node node)
/* create directory (short name) */
CALL_AND_CHECK(ret, mkdir(dir_name, 0777), ((ret == 0) || (errno == EEXIST)), "dir_name=%s", dir_name);
/* try to create again */
CALL_AND_CHECK(ret, mkdir(dir_name, 0777), ((ret == 0) || (errno == EEXIST)), "dir_name=%s", dir_name);
/* change to new directory */
CALL_AND_CHECK(ret, chdir(dir_name), ret == 0, "dir_name=%s", dir_name);