diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2021-02-12 18:49:16 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-13 00:40:31 +0100 |
commit | 546cdde776e88635b9faf9996d753a5eccaf9bfa (patch) | |
tree | 9e029a9a3681eb8772413d1680497abc642a7a7c /Kernel/Syscalls | |
parent | e1db8094b61aae6493cb10426b09d5f4c7177e8f (diff) | |
download | serenity-546cdde776e88635b9faf9996d753a5eccaf9bfa.zip |
Kernel: clock_nanosleep's 'flags' is not a bitset
This had the interesting effect that most, but not all, non-zero values
were interpreted as an absolute value.
Diffstat (limited to 'Kernel/Syscalls')
-rw-r--r-- | Kernel/Syscalls/clock.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Kernel/Syscalls/clock.cpp b/Kernel/Syscalls/clock.cpp index c28552953d..557d9376ce 100644 --- a/Kernel/Syscalls/clock.cpp +++ b/Kernel/Syscalls/clock.cpp @@ -76,7 +76,17 @@ int Process::sys$clock_nanosleep(Userspace<const Syscall::SC_clock_nanosleep_par if (!copy_from_user(&requested_sleep, params.requested_sleep)) return -EFAULT; - bool is_absolute = params.flags & TIMER_ABSTIME; + bool is_absolute; + switch (params.flags) { + case 0: + is_absolute = false; + break; + case TIMER_ABSTIME: + is_absolute = true; + break; + default: + return -EINVAL; + } if (!TimeManagement::is_valid_clock_id(params.clock_id)) return -EINVAL; |