summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-06 12:02:59 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-06 13:06:05 +0200
commite3b063581edd0f3a6811fb8d052cdc02d1dcda9a (patch)
tree80887b94abc8540c9a3c2ca12e4766509ad94222 /Kernel/Syscalls
parentb083b165a7b006ec982070d8f6399c27ec2eefef (diff)
downloadserenity-e3b063581edd0f3a6811fb8d052cdc02d1dcda9a.zip
Kernel: Use TRY() in sys$alarm()
Diffstat (limited to 'Kernel/Syscalls')
-rw-r--r--Kernel/Syscalls/alarm.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/Kernel/Syscalls/alarm.cpp b/Kernel/Syscalls/alarm.cpp
index d6847c1fbd..3ffb2d8f53 100644
--- a/Kernel/Syscalls/alarm.cpp
+++ b/Kernel/Syscalls/alarm.cpp
@@ -30,9 +30,7 @@ KResultOr<FlatPtr> Process::sys$alarm(unsigned seconds)
auto deadline = TimeManagement::the().current_time(CLOCK_REALTIME_COARSE);
deadline = deadline + Time::from_seconds(seconds);
if (!m_alarm_timer) {
- m_alarm_timer = adopt_ref_if_nonnull(new (nothrow) Timer());
- if (!m_alarm_timer)
- return ENOMEM;
+ m_alarm_timer = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Timer));
}
auto timer_was_added = TimerQueue::the().add_timer_without_id(*m_alarm_timer, CLOCK_REALTIME_COARSE, deadline, [this]() {
[[maybe_unused]] auto rc = send_signal(SIGALRM, nullptr);