From 75a193b7611bade31a150dfcc528b973e3d46231 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Mon, 2 Nov 2020 16:18:29 -0300 Subject: linux: Allow adjtime with NULL argument [BZ #26833] The adjtime interface allows return the amount of time remaining from any previous adjustment that has not yet been completed by passing a NULL as first argument. This was introduced with y2038 support 0308077e3a. Checked on i686-linux-gnu. Reviewed-by: Lukasz Majewski --- sysdeps/unix/sysv/linux/adjtime.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'sysdeps/unix/sysv') diff --git a/sysdeps/unix/sysv/linux/adjtime.c b/sysdeps/unix/sysv/linux/adjtime.c index 3f9a4ea2eb..6d1d1b6af2 100644 --- a/sysdeps/unix/sysv/linux/adjtime.c +++ b/sysdeps/unix/sysv/linux/adjtime.c @@ -68,11 +68,16 @@ libc_hidden_def (__adjtime64) int __adjtime (const struct timeval *itv, struct timeval *otv) { - struct __timeval64 itv64, otv64; + struct __timeval64 itv64, *pitv64 = NULL; + struct __timeval64 otv64; int retval; - itv64 = valid_timeval_to_timeval64 (*itv); - retval = __adjtime64 (&itv64, otv != NULL ? &otv64 : NULL); + if (itv != NULL) + { + itv64 = valid_timeval_to_timeval64 (*itv); + pitv64 = &itv64; + } + retval = __adjtime64 (pitv64, otv != NULL ? &otv64 : NULL); if (otv != NULL) *otv = valid_timeval64_to_timeval (otv64); -- cgit 1.4.1