From cbc7cbf1dae1ad8c1f7f3314b9a22f75fafb48c0 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 17 Jul 2020 11:26:51 +0930 Subject: [PATCH] tools/configurator: fix compile error with -O2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In file included from /usr/include/string.h:495, from configuratortest.c:2: In function ‘strncpy’, inlined from ‘main’ at configuratortest.c:6:2: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ specified bound 8 equals destination size [-Wstringop-truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Rusty Russell --- tools/configurator/configurator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c index c8b131cc..33651ef4 100644 --- a/tools/configurator/configurator.c +++ b/tools/configurator/configurator.c @@ -411,7 +411,7 @@ static const struct test base_tests[] = { "int main(int argc, char *argv[]) {\n" " (void)argc;\n" " char pad[sizeof(int *) * 1];\n" - " strncpy(pad, argv[0], sizeof(pad));\n" + " memcpy(pad, argv[0], sizeof(pad));\n" " int *x = (int *)pad, *y = (int *)(pad + 1);\n" " return *x == *y;\n" "}\n" }, -- 2.39.2