diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-07-26 03:42:16 -0700 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-07-27 01:23:37 +0430 |
commit | 46c9b1d81c22c6840733e821bc0859dda1d65e7d (patch) | |
tree | 864d024f71fd151dc196f99ee51b6e5a3bebd03a /Kernel/TTY | |
parent | 9a04f53a0fcb8d6c3d449ca89f7fdbb83db68dd5 (diff) | |
download | serenity-46c9b1d81c22c6840733e821bc0859dda1d65e7d.zip |
Kernel+LibC: Use argument for TIOCGPGRP ioctl value
In preparation for modifying the Kernel IOCTL API to return KResult
instead of int, we need to fix this ioctl to an argument to receive
it's return value, instead of using the actual function return value.
Diffstat (limited to 'Kernel/TTY')
-rw-r--r-- | Kernel/TTY/TTY.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Kernel/TTY/TTY.cpp b/Kernel/TTY/TTY.cpp index a58b882b4e..c5a7802133 100644 --- a/Kernel/TTY/TTY.cpp +++ b/Kernel/TTY/TTY.cpp @@ -469,8 +469,13 @@ int TTY::ioctl(FileDescription&, unsigned request, Userspace<void*> arg) } #endif switch (request) { - case TIOCGPGRP: - return this->pgid().value(); + case TIOCGPGRP: { + auto user_pgid = static_ptr_cast<pid_t*>(arg); + auto pgid = this->pgid().value(); + if (!copy_to_user(user_pgid, &pgid)) + return -EFAULT; + return 0; + } case TIOCSPGRP: { ProcessGroupID pgid = static_cast<pid_t>(arg.ptr()); if (pgid <= 0) |