diff options
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch')
-rw-r--r-- | meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch b/meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch new file mode 100644 index 0000000000..fcc7c500ab --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | From f9fd4546c25a15629544bc4642a74d7909cc0840 Mon Sep 17 00:00:00 2001 | ||
2 | From: Martin Jansa <Martin.Jansa@gmail.com> | ||
3 | Date: Fri, 1 Jun 2018 15:22:28 +0000 | ||
4 | Subject: [PATCH] time-util: fix build with gcc8 -Werror=format-truncation= | ||
5 | |||
6 | * it fails with gcc8 when -O1 or -Os is used (and -ftree-vrp which is added by -O2 and higher isn't used) | ||
7 | |||
8 | ../git/src/basic/time-util.c: In function 'format_timespan': | ||
9 | ../git/src/basic/time-util.c:508:46: error: '%0*llu' directive output between 1 and 2147483647 bytes may cause result to exceed 'INT_MAX' [-Werror=format-truncation=] | ||
10 | "%s"USEC_FMT".%0*"PRI_USEC"%s", | ||
11 | ^~~~ | ||
12 | ../git/src/basic/time-util.c:508:60: note: format string is defined here | ||
13 | "%s"USEC_FMT".%0*"PRI_USEC"%s", | ||
14 | ../git/src/basic/time-util.c:508:46: note: directive argument in the range [0, 18446744073709551614] | ||
15 | "%s"USEC_FMT".%0*"PRI_USEC"%s", | ||
16 | ^~~~ | ||
17 | ../git/src/basic/time-util.c:507:37: note: 'snprintf' output 4 or more bytes (assuming 2147483651) into a destination of size 4294967295 | ||
18 | k = snprintf(p, l, | ||
19 | ^~~~~~~~~~~~~~ | ||
20 | "%s"USEC_FMT".%0*"PRI_USEC"%s", | ||
21 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
22 | p > buf ? " " : "", | ||
23 | ~~~~~~~~~~~~~~~~~~~ | ||
24 | a, | ||
25 | ~~ | ||
26 | j, | ||
27 | ~~ | ||
28 | b, | ||
29 | ~~ | ||
30 | table[i].suffix); | ||
31 | ~~~~~~~~~~~~~~~~ | ||
32 | cc1: some warnings being treated as errors | ||
33 | |||
34 | Upstream-Status: Submitted https://github.com/systemd/systemd/pull/9156 | ||
35 | |||
36 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
37 | --- | ||
38 | src/basic/time-util.c | 2 +- | ||
39 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
40 | |||
41 | diff --git a/src/basic/time-util.c b/src/basic/time-util.c | ||
42 | index 0601d4fa9..db5a9cd78 100644 | ||
43 | --- a/src/basic/time-util.c | ||
44 | +++ b/src/basic/time-util.c | ||
45 | @@ -484,7 +484,7 @@ char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy) { | ||
46 | /* Let's see if we should shows this in dot notation */ | ||
47 | if (t < USEC_PER_MINUTE && b > 0) { | ||
48 | usec_t cc; | ||
49 | - int j; | ||
50 | + signed char j; | ||
51 | |||
52 | j = 0; | ||
53 | for (cc = table[i].usec; cc > 1; cc /= 10) | ||