lx_fs: handle errors on mkdir correctly

Fixes #2444
This commit is contained in:
Christian Prochaska
2017-06-12 16:02:11 +02:00
committed by Christian Helmuth
parent c8e4d2715b
commit a1b1525ec1
3 changed files with 18 additions and 10 deletions

View File

@ -42,8 +42,16 @@ class File_system::Directory : public Node
if (create) {
mode_t ugo = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
ret = mkdir(path, ugo);
if (ret == -1)
throw No_space();
if (ret == -1) {
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;