mirror of git://git.musl-libc.org/musl
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.
This commit is contained in:
parent
a108127256
commit
0847902ab9
|
@ -8,7 +8,7 @@ int clock_getres(clockid_t clk, struct timespec *ts)
|
||||||
if (SYS_clock_getres != SYS_clock_getres_time64) {
|
if (SYS_clock_getres != SYS_clock_getres_time64) {
|
||||||
long ts32[2];
|
long ts32[2];
|
||||||
int r = __syscall(SYS_clock_getres, clk, ts32);
|
int r = __syscall(SYS_clock_getres, clk, ts32);
|
||||||
if (!r) {
|
if (!r && ts) {
|
||||||
ts->tv_sec = ts32[0];
|
ts->tv_sec = ts32[0];
|
||||||
ts->tv_nsec = ts32[1];
|
ts->tv_nsec = ts32[1];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue