diff options
author | Rich Felker <dalias@aerifal.cx> | 2019-08-07 21:35:28 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2019-08-07 21:35:28 -0400 |
commit | 0847902ab99065a48f9bd3729b6e676288dfd69e (patch) | |
tree | f2cfdd9ec74374828c5f3f534762eb13748b4a32 /src/time/clock_getres.c | |
parent | a108127256a188130a80d6c7762ec8820e663b7c (diff) | |
download | musl-0847902ab99065a48f9bd3729b6e676288dfd69e.tar.gz musl-0847902ab99065a48f9bd3729b6e676288dfd69e.tar.bz2 musl-0847902ab99065a48f9bd3729b6e676288dfd69e.tar.xz musl-0847902ab99065a48f9bd3729b6e676288dfd69e.zip |
in clock_getres, check for null pointer before storing result
POSIX allows a null pointer, in which case the function only checks
the validity of the clock id argument.
Diffstat (limited to 'src/time/clock_getres.c')
-rw-r--r-- | src/time/clock_getres.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/time/clock_getres.c b/src/time/clock_getres.c index f0f41cf9..81c67037 100644 --- a/src/time/clock_getres.c +++ b/src/time/clock_getres.c @@ -8,7 +8,7 @@ int clock_getres(clockid_t clk, struct timespec *ts) if (SYS_clock_getres != SYS_clock_getres_time64) { long ts32[2]; int r = __syscall(SYS_clock_getres, clk, ts32); - if (!r) { + if (!r && ts) { ts->tv_sec = ts32[0]; ts->tv_nsec = ts32[1]; } |