1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:27:35 +00:00

Kernel: Use Userspace<T> for the fstat syscall

This commit is contained in:
Brian Gianforcaro 2020-08-09 14:57:50 -07:00 committed by Andreas Kling
parent 8dd78201a4
commit 431145148e
2 changed files with 3 additions and 4 deletions

View file

@ -31,7 +31,7 @@
namespace Kernel {
int Process::sys$fstat(int fd, stat* user_statbuf)
int Process::sys$fstat(int fd, Userspace<stat*> user_statbuf)
{
REQUIRE_PROMISE(stdio);
if (!validate_write_typed(user_statbuf))
@ -39,8 +39,7 @@ int Process::sys$fstat(int fd, stat* user_statbuf)
auto description = file_description(fd);
if (!description)
return -EBADF;
stat buffer;
memset(&buffer, 0, sizeof(buffer));
stat buffer = {};
int rc = description->fstat(buffer);
copy_to_user(user_statbuf, &buffer);
return rc;