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
This commit is contained in:
John Baldwin 2025-04-11 15:12:58 -04:00
parent 4b60fac3a5
commit faae895fec

View file

@ -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);
})