summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/ttyname.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Syscalls/ttyname.cpp')
-rw-r--r--Kernel/Syscalls/ttyname.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Kernel/Syscalls/ttyname.cpp b/Kernel/Syscalls/ttyname.cpp
index 2e73d06a9c..123a02498b 100644
--- a/Kernel/Syscalls/ttyname.cpp
+++ b/Kernel/Syscalls/ttyname.cpp
@@ -11,7 +11,7 @@
namespace Kernel {
-KResultOr<FlatPtr> Process::sys$ttyname(int fd, Userspace<char*> buffer, size_t size)
+ErrorOr<FlatPtr> Process::sys$ttyname(int fd, Userspace<char*> buffer, size_t size)
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
REQUIRE_PROMISE(tty);
@@ -21,10 +21,11 @@ KResultOr<FlatPtr> Process::sys$ttyname(int fd, Userspace<char*> buffer, size_t
auto& tty_name = description->tty()->tty_name();
if (size < tty_name.length() + 1)
return ERANGE;
- return copy_to_user(buffer, tty_name.characters(), tty_name.length() + 1);
+ TRY(copy_to_user(buffer, tty_name.characters(), tty_name.length() + 1));
+ return 0;
}
-KResultOr<FlatPtr> Process::sys$ptsname(int fd, Userspace<char*> buffer, size_t size)
+ErrorOr<FlatPtr> Process::sys$ptsname(int fd, Userspace<char*> buffer, size_t size)
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
REQUIRE_PROMISE(tty);
@@ -35,7 +36,8 @@ KResultOr<FlatPtr> Process::sys$ptsname(int fd, Userspace<char*> buffer, size_t
auto& pts_name = master_pty->pts_name();
if (size < pts_name.length() + 1)
return ERANGE;
- return copy_to_user(buffer, pts_name.characters(), pts_name.length() + 1);
+ TRY(copy_to_user(buffer, pts_name.characters(), pts_name.length() + 1));
+ return 0;
}
}