This change fixes the behavior of clock_getres to not return an error
when receiving a NULL as its output argument, in accordance with docs.
Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
GitHub-Closes: #1154
{
int error;
- if (!tp) {
- error = EFAULT;
- goto out_error;
- }
-
switch (clk_id) {
case CLOCK_MONOTONIC:
case CLOCK_MONOTONIC_COARSE:
case CLOCK_REALTIME:
- tp->tv_sec = 0;
- tp->tv_nsec = UKPLAT_TIME_TICK_NSEC;
+ if (tp) {
+ tp->tv_sec = 0;
+ tp->tv_nsec = UKPLAT_TIME_TICK_NSEC;
+ }
break;
default:
error = EINVAL;