diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2006-09-19 07:44:15 +0000 |
---|---|---|
committer | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2006-09-19 07:44:15 +0000 |
commit | 3f13b12507b91750a350e57370d334dcd5ac1794 (patch) | |
tree | d22a50a91544d186778c9c3ed1dfe8f5516d4e27 /libc | |
parent | 996be4d2f17f10979c591575dcff12e502c4a87e (diff) |
Allow the res argument to clock_getres() to be NULL.
Diffstat (limited to 'libc')
-rw-r--r-- | libc/sysdeps/linux/common/clock_getres.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libc/sysdeps/linux/common/clock_getres.c b/libc/sysdeps/linux/common/clock_getres.c index 8ee782845..93487c3d2 100644 --- a/libc/sysdeps/linux/common/clock_getres.c +++ b/libc/sysdeps/linux/common/clock_getres.c @@ -18,15 +18,18 @@ libc_hidden_proto(sysconf) int clock_getres(clockid_t clock_id, struct timespec* res) { - long clk_tck; int retval = -1; switch (clock_id) { case CLOCK_REALTIME: - if ((clk_tck = sysconf(_SC_CLK_TCK)) < 0) - clk_tck = 100; - res->tv_sec = 0; - res->tv_nsec = 1000000000 / clk_tck; + if (res) { + long clk_tck; + + if ((clk_tck = sysconf(_SC_CLK_TCK)) < 0) + clk_tck = 100; + res->tv_sec = 0; + res->tv_nsec = 1000000000 / clk_tck; + } retval = 0; break; |