hurd: Fix timer/clock_getres crash on NULL res parameter
POSIX allows res to be NULL.
This commit is contained in:
parent
2c040d0b90
commit
67ca1c5560
|
@ -34,8 +34,11 @@ realtime_getres (struct timespec *res)
|
||||||
/* This implementation assumes that the realtime clock has a
|
/* This implementation assumes that the realtime clock has a
|
||||||
resolution higher than 1 second. This is the case for any
|
resolution higher than 1 second. This is the case for any
|
||||||
reasonable implementation. */
|
reasonable implementation. */
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
res->tv_sec = 0;
|
res->tv_sec = 0;
|
||||||
res->tv_nsec = 1000000000 / clk_tck;
|
res->tv_nsec = 1000000000 / clk_tck;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue