Kernel: Use TRY() in sys$mknod()

This commit is contained in:
Andreas Kling 2021-09-05 16:18:24 +02:00
parent 2658ab4a80
commit b01e4b171d
Notes: sideshowbarker 2024-07-18 04:42:03 +09:00

View file

@ -19,10 +19,8 @@ KResultOr<FlatPtr> Process::sys$mknod(Userspace<const Syscall::SC_mknod_params*>
return EFAULT;
if (!is_superuser() && !is_regular_file(params.mode) && !is_fifo(params.mode) && !is_socket(params.mode))
return EPERM;
auto path = get_syscall_path_argument(params.path);
if (path.is_error())
return path.error();
return VirtualFileSystem::the().mknod(path.value()->view(), params.mode & ~umask(), params.dev, current_directory());
auto path = TRY(get_syscall_path_argument(params.path));
return VirtualFileSystem::the().mknod(path->view(), params.mode & ~umask(), params.dev, current_directory());
}
}