aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-11-02 16:18:29 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-11-09 11:19:35 -0300
commit75a193b7611bade31a150dfcc528b973e3d46231 (patch)
tree0ede2fea4979986c6031b3fd037077b14d855cf4 /sysdeps
parent5edf3d9fd6efe06fda37b2a460e60690a90457a4 (diff)
downloadglibc-75a193b7611bade31a150dfcc528b973e3d46231.tar
glibc-75a193b7611bade31a150dfcc528b973e3d46231.tar.gz
glibc-75a193b7611bade31a150dfcc528b973e3d46231.tar.bz2
glibc-75a193b7611bade31a150dfcc528b973e3d46231.zip
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 <lukma@denx.de>
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/adjtime.c11
1 files changed, 8 insertions, 3 deletions
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);