From: "Kacper Piwiński" <vfjpl1@gmail.com>
To: libc-alpha@sourceware.org
Subject: [PATCH] linux: fix ntp_gettime abi break
Date: Tue, 21 Feb 2023 05:04:15 +0100 [thread overview]
Message-ID: <CAKVti-BRav=mmfcQBEz_qpezmKfR_fFW9uihJb+QXiJazugTmA@mail.gmail.com> (raw)
Between versions v2.11 and v2.12 struct ntptimeval got new fields.
That wasn't a problem because new function ntp_gettimex was created
(and made default) to support new struct. Old ntp_gettime was not
using new fields so it was safe to call with old struct
definition. Then between versions v2.31 and v2.32 when working on
y2038 bugs, ntp_gettime start setting new fields.
Sets fields manually to maintain compatibility with v2.11 struct definition.
Author: Kacper Piwiński <vfjpl1@gmail.com>
---
sysdeps/unix/sysv/linux/ntp_gettime.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sysdeps/unix/sysv/linux/ntp_gettime.c
b/sysdeps/unix/sysv/linux/ntp_gettime.c
index 4879573530..3844b2e487 100644
--- a/sysdeps/unix/sysv/linux/ntp_gettime.c
+++ b/sysdeps/unix/sysv/linux/ntp_gettime.c
@@ -54,7 +54,11 @@ __ntp_gettime (struct ntptimeval *ntv)
int result;
result = __ntp_gettime64 (&ntv64);
- *ntv = valid_ntptimeval64_to_ntptimeval (ntv64);
+ //manually update fields to maintain abi with v2.11 struct definition
+ struct ntptimeval tntv = valid_ntptimeval64_to_ntptimeval (ntv64);
+ ntv->time = tntv.time;
+ ntv->maxerror = tntv.maxerror;
+ ntv->esterror = tntv.esterror;
return result;
}
--
2.38.1.windows.1
next reply other threads:[~2023-02-21 4:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-21 4:04 Kacper Piwiński [this message]
2023-02-21 11:24 ` Andreas Schwab
2023-02-24 15:15 ` Kacper Piwiński
2023-03-02 17:47 ` Carlos O'Donell
2023-03-03 8:47 ` Kacper Piwiński
2023-03-03 13:03 ` Adhemerval Zanella Netto
2023-03-03 16:43 ` Kacper Piwiński
2023-03-07 14:11 ` Adhemerval Zanella Netto
2023-03-08 8:58 Kacper Piwiński
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAKVti-BRav=mmfcQBEz_qpezmKfR_fFW9uihJb+QXiJazugTmA@mail.gmail.com' \
--to=vfjpl1@gmail.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).