commit 59a643d
Michael Forney
·
2026-03-13 11:03:08 +0000 UTC
parent 77274d2
util-linux: Fix build without -ffunction-sections Even though strtotimespec_or_err isn't used by anything we build, other functions in strutils.o are, pulling it in. Fix it by using double instead.
2 files changed,
+17,
-6
1@@ -1,14 +1,14 @@
2-From 74dc839d640c8df63e597c5826458bb6a3b57cb2 Mon Sep 17 00:00:00 2001
3+From 7a6a46d6811acd06661f4f3f2e36d69157b695bf Mon Sep 17 00:00:00 2001
4 From: Michael Forney <mforney@mforney.org>
5 Date: Mon, 6 Sep 2021 18:05:22 -0700
6 Subject: [PATCH] Avoid use of long double
7
8 ---
9- lib/strutils.c | 6 ++++--
10- 1 file changed, 4 insertions(+), 2 deletions(-)
11+ lib/strutils.c | 10 ++++++----
12+ 1 file changed, 6 insertions(+), 4 deletions(-)
13
14 diff --git a/lib/strutils.c b/lib/strutils.c
15-index 54746fcae..fb42fb0cf 100644
16+index 54746fcae..efadd67ff 100644
17 --- a/lib/strutils.c
18 +++ b/lib/strutils.c
19 @@ -456,6 +456,7 @@ err:
20@@ -27,7 +27,7 @@ index 54746fcae..fb42fb0cf 100644
21
22 uintmax_t strtosize_or_err(const char *str, const char *errmesg)
23 {
24-@@ -500,9 +502,9 @@ uintmax_t strtosize_or_err(const char *str, const char *errmesg)
25+@@ -500,18 +502,18 @@ uintmax_t strtosize_or_err(const char *str, const char *errmesg)
26
27 void strtotimeval_or_err(const char *str, struct timeval *tv, const char *errmesg)
28 {
29@@ -39,6 +39,17 @@ index 54746fcae..fb42fb0cf 100644
30 tv->tv_sec = (time_t) user_input;
31 tv->tv_usec = (suseconds_t)((user_input - tv->tv_sec) * 1000000);
32 }
33+
34+ void strtotimespec_or_err(const char *str, struct timespec *ts, const char *errmesg)
35+ {
36+- long double user_input;
37++ double user_input;
38+
39+- user_input = strtold_or_err(str, errmesg);
40++ user_input = strtod_or_err(str, errmesg);
41+ ts->tv_sec = (time_t) user_input;
42+ ts->tv_nsec = (long)((user_input - ts->tv_sec) * 1000000000);
43+ }
44 --
45 2.49.0
46
+1,
-1
1@@ -1 +1 @@
2-2.41.3 0
3+2.41.3 1