mkdir: propagate error to userspace
@@ -402,6 +402,7 @@ sysreturn mkdir(const char *pathname, int mode)
{
heap h = heap_general(get_kernel_heaps());
buffer cwd = wrap_buffer_cstring(h, "/"); /* XXX */
+ int rc;
/* canonicalize the path */
char *final_path = canonicalize_path(h, cwd,
@@ -410,9 +411,12 @@ sysreturn mkdir(const char *pathname, int mode)
thread_log(current, "%s: (mode %d) pathname %s => %s\n",
__func__, mode, pathname, final_path);
- filesystem_mkdir(current->p->fs, final_path);
+ rc = filesystem_mkdir(current->p->fs, final_path);
- return set_syscall_error(current, EINVAL);
+ if (rc)
+ return set_syscall_error(current, rc);
+ else
+ return set_syscall_return(current, rc);
}
sysreturn getrandom(void *buf, u64 buflen, unsigned int flags)
