summaryrefslogtreecommitdiff
path: root/package/busybox/patches/002-hwclock-musl.patch
blob: a5b9ff50d7fb7e6d8279caf7b943393e39217099 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
diff -Nur busybox-1.36.1.orig/util-linux/hwclock.c busybox-1.36.1/util-linux/hwclock.c
--- busybox-1.36.1.orig/util-linux/hwclock.c	2021-01-01 11:52:27.000000000 +0100
+++ busybox-1.36.1/util-linux/hwclock.c	2024-04-10 11:18:06.569673535 +0200
@@ -136,10 +136,24 @@
 	 * because "it's deprecated by POSIX, therefore it's fine
 	 * if we gratuitously break stuff" :(
 	 */
-#if !defined(SYS_settimeofday) && defined(SYS_settimeofday_time32)
-# define SYS_settimeofday SYS_settimeofday_time32
-#endif
+# if !defined(SYS_settimeofday) && defined(SYS_settimeofday_time32)
+#  define SYS_settimeofday SYS_settimeofday_time32
+# endif
+# if defined(SYS_settimeofday)
 	int ret = syscall(SYS_settimeofday, NULL, tz);
+# else
+	/* Some new architectures have neither settimeofday nor
+	 * settimeofday_time32, and the whole kernel timezone handling appears
+	 * to have been dropped due to some oddities in the API.  See:
+	 *
+	 *   - glibc's commit c3f9aef063 ("Use clock_settime to implement settimeofday.")
+	 *   - https://github.com/systemd/systemd/issues/13305
+	 *   - https://inbox.sourceware.org/libc-alpha/cb015d0d1d29e4b948c7118c5b12ff2bed83a6ec.1561421042.git.alistair.francis@wdc.com/
+	 *
+	 * So instead just silently drop these calls.
+	 */
+	int ret = -ENOSYS;
+# endif
 #else
 	int ret = settimeofday(NULL, tz);
 #endif