Applied, thanks
On Mon, Aug 10, 2020 at 4:59 PM Eddie James <eajames+busy...@linux.ibm.com> wrote: > > From: Eddie James <eaja...@linux.ibm.com> > > The glibc implementation changed for settimeofday, resulting in "invalid > argument" error when attempting to set both timezone and time with a single > call. Fix this by calling settimeofday twice > > Signed-off-by: Eddie James <eaja...@linux.ibm.com> > --- > util-linux/hwclock.c | 17 +++++++++++++---- > 1 file changed, 13 insertions(+), 4 deletions(-) > > diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c > index dc97d8fb4..69b2d96e1 100644 > --- a/util-linux/hwclock.c > +++ b/util-linux/hwclock.c > @@ -129,10 +129,14 @@ static void to_sys_clock(const char **pp_rtcname, int > utc) > */ > tz.tz_dsttime = 0; > > + /* glibc v2.31+ returns an error if both args are non-NULL */ > + if (settimeofday(NULL, &tz)) > + bb_simple_perror_msg_and_die("settimeofday tz"); > + > tv.tv_sec = read_rtc(pp_rtcname, NULL, utc); > tv.tv_usec = 0; > - if (settimeofday(&tv, &tz)) > - bb_simple_perror_msg_and_die("settimeofday"); > + if (settimeofday(&tv, NULL)) > + bb_simple_perror_msg_and_die("settimeofday tv"); > } > > static void from_sys_clock(const char **pp_rtcname, int utc) > @@ -283,8 +287,13 @@ static void set_system_clock_timezone(int utc) > gettimeofday(&tv, NULL); > if (!utc) > tv.tv_sec += tz.tz_minuteswest * 60; > - if (settimeofday(&tv, &tz)) > - bb_simple_perror_msg_and_die("settimeofday"); > + > + /* glibc v2.31+ returns an error if both args are non-NULL */ > + if (settimeofday(NULL, &tz)) > + bb_simple_perror_msg_and_die("settimeofday tz"); > + > + if (settimeofday(&tv, NULL)) > + bb_simple_perror_msg_and_die("settimeofday tv"); > } > > //usage:#define hwclock_trivial_usage > -- > 2.26.2 > > _______________________________________________ > busybox mailing list > busybox@busybox.net > http://lists.busybox.net/mailman/listinfo/busybox _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox