summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2006-09-19 07:44:15 +0000
committerPeter Kjellerstedt <peter.kjellerstedt@axis.com>2006-09-19 07:44:15 +0000
commit3f13b12507b91750a350e57370d334dcd5ac1794 (patch)
treed22a50a91544d186778c9c3ed1dfe8f5516d4e27 /libc/sysdeps/linux
parent996be4d2f17f10979c591575dcff12e502c4a87e (diff)
Allow the res argument to clock_getres() to be NULL.
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r--libc/sysdeps/linux/common/clock_getres.c13
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;