From: Samuel Thibault Date: Sat, 15 Jan 2022 14:37:03 +0000 (+0100) Subject: hurd: Fix timer/clock_getres crash on NULL res parameter X-Git-Tag: glibc-2.35~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67ca1c55603d3e99c26e3edf7955a58b78cfe0ad;p=thirdparty%2Fglibc.git hurd: Fix timer/clock_getres crash on NULL res parameter POSIX allows res to be NULL. --- diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c index 252fc9b4edf..b6c3a107915 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; }