summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/mdadm/files/0001-fix-gcc-8-format-truncation-warning.patch
blob: 3cf295106fba2c6ead12babda42c3a6c6dcfbed3 (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
32
33
34
35
36
From 78e5bb08971a5644a56af60d51ef35e13522e811 Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Fri, 14 Dec 2018 15:12:31 +0800
Subject: [PATCH] fix gcc-8 format-truncation warning

While compiling with `-Werror=format-truncation=', it failed
[snip]
|super0.c:236:32: error: 'snprintf' output may be truncated
before the last format character [-Werror=format-truncation=]
|   snprintf(nb, sizeof(nb), "%4d", d);
|                                ^
|super0.c:236:3: note: 'snprintf' output between 5 and 12 bytes
into a destination of size 11
|   snprintf(nb, sizeof(nb), "%4d", d);
[snip]

Upstream-Status: Submitted [https://github.com/neilbrown/mdadm/pull/34]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 super0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/super0.c b/super0.c
index a7c5f81..a79b6bd 100644
--- a/super0.c
+++ b/super0.c
@@ -229,7 +229,7 @@ static void examine_super0(struct supertype *st, char *homehost)
 	     d++) {
 		mdp_disk_t *dp;
 		char *dv;
-		char nb[11];
+		char nb[12];
 		int wonly, failfast;
 		if (d>=0) dp = &sb->disks[d];
 		else dp = &sb->this_disk;