From faae895fec6571242ae05b11bc7eba0dff83fa49 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 11 Apr 2025 15:12:58 -0400 Subject: [PATCH] fusefs tests: Use memcpy to work around a -Wstrlcpy-strlcast-size warning tests/sys/fs/fusefs/xattr.cc:572:50: error: size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination [-Werror,-Wstrlcpy-strlcat-size] 572 | strlcpy((char*)out.body.bytes, attrs1, sizeof(attrs1)); | ~~~~~~~^~~~~~~ The warning is correct in that the size is the size of the source, but that is intended in this case. Use memcpy() instead of strlcpy() to match the same code in the size_only_race_smaller test above. Differential Revision: https://reviews.freebsd.org/D49786 --- tests/sys/fs/fusefs/xattr.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/fs/fusefs/xattr.cc b/tests/sys/fs/fusefs/xattr.cc index b1cbb9ffa768..0cd2783551b4 100644 --- a/tests/sys/fs/fusefs/xattr.cc +++ b/tests/sys/fs/fusefs/xattr.cc @@ -569,7 +569,7 @@ TEST_F(Listxattr, size_only_race_smaller) })); expect_listxattr(ino, sizeof(attrs0), ReturnImmediate([&](auto in __unused, auto& out) { - strlcpy((char*)out.body.bytes, attrs1, sizeof(attrs1)); + memcpy((char*)out.body.bytes, attrs1, sizeof(attrs1)); out.header.len = sizeof(fuse_out_header) + sizeof(attrs1); })