diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-01-15 15:37:03 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-01-15 15:37:03 +0100 |
commit | 67ca1c55603d3e99c26e3edf7955a58b78cfe0ad (patch) | |
tree | f8d6b3e5147b8d4ee4fd25ff9627fd22c5fc5650 /sysdeps/posix | |
parent | 2c040d0b904ca8dfd34e72dc9b4722d92436ad7e (diff) | |
download | glibc-67ca1c55603d3e99c26e3edf7955a58b78cfe0ad.tar.gz glibc-67ca1c55603d3e99c26e3edf7955a58b78cfe0ad.tar.xz glibc-67ca1c55603d3e99c26e3edf7955a58b78cfe0ad.zip |
hurd: Fix timer/clock_getres crash on NULL res parameter
POSIX allows res to be NULL.
Diffstat (limited to 'sysdeps/posix')
-rw-r--r-- | sysdeps/posix/clock_getres.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c index 252fc9b4ed..b6c3a10791 100644 --- a/sysdeps/posix/clock_getres.c +++ b/sysdeps/posix/clock_getres.c @@ -34,8 +34,11 @@ realtime_getres (struct timespec *res) /* This implementation assumes that the realtime clock has a resolution higher than 1 second. This is the case for any reasonable implementation. */ - res->tv_sec = 0; - res->tv_nsec = 1000000000 / clk_tck; + if (res) + { + res->tv_sec = 0; + res->tv_nsec = 1000000000 / clk_tck; + } return 0; } |