mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-30 08:03:59 +00:00
rump_fs: handle errors on mkdir correctly
This commit is contained in:
parent
7ff2927edb
commit
92a339befd
@ -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>}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user