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.
This commit is contained in:
Ben Wiederhake 2021-02-12 18:49:16 +01:00 committed by Andreas Kling
parent e1db8094b6
commit 546cdde776

View file

@ -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;