Patrick Williams | 44b3caf | 2024-04-12 16:51:14 -0500 | [diff] [blame] | 1 | From 78e5bb08971a5644a56af60d51ef35e13522e811 Mon Sep 17 00:00:00 2001 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 2 | From: Hongxu Jia <hongxu.jia@windriver.com> |
| 3 | Date: Fri, 14 Dec 2018 15:12:31 +0800 |
| 4 | Subject: [PATCH] fix gcc-8 format-truncation warning |
| 5 | |
| 6 | While compiling with `-Werror=format-truncation=', it failed |
| 7 | [snip] |
| 8 | |super0.c:236:32: error: 'snprintf' output may be truncated |
| 9 | before the last format character [-Werror=format-truncation=] |
| 10 | | snprintf(nb, sizeof(nb), "%4d", d); |
| 11 | | ^ |
| 12 | |super0.c:236:3: note: 'snprintf' output between 5 and 12 bytes |
| 13 | into a destination of size 11 |
| 14 | | snprintf(nb, sizeof(nb), "%4d", d); |
| 15 | [snip] |
| 16 | |
| 17 | Upstream-Status: Submitted [https://github.com/neilbrown/mdadm/pull/34] |
| 18 | |
| 19 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> |
| 20 | --- |
| 21 | super0.c | 2 +- |
| 22 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 23 | |
| 24 | diff --git a/super0.c b/super0.c |
Patrick Williams | 44b3caf | 2024-04-12 16:51:14 -0500 | [diff] [blame] | 25 | index a7c5f81..a79b6bd 100644 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 26 | --- a/super0.c |
| 27 | +++ b/super0.c |
| 28 | @@ -229,7 +229,7 @@ static void examine_super0(struct supertype *st, char *homehost) |
| 29 | d++) { |
| 30 | mdp_disk_t *dp; |
| 31 | char *dv; |
| 32 | - char nb[11]; |
| 33 | + char nb[12]; |
| 34 | int wonly, failfast; |
| 35 | if (d>=0) dp = &sb->disks[d]; |
| 36 | else dp = &sb->this_disk; |