Page MenuHomeFreeBSD

fusefs tests: Use memcpy to work around a -Wstrlcpy-strlcast-size warning
ClosedPublic

Authored by jhb on Fri, Apr 11, 5:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 17, 11:54 AM
Unknown Object (File)
Thu, Apr 17, 2:45 AM
Unknown Object (File)
Thu, Apr 17, 2:10 AM
Unknown Object (File)
Sun, Apr 13, 5:00 AM
Unknown Object (File)
Sun, Apr 13, 4:47 AM
Unknown Object (File)
Sun, Apr 13, 1:05 AM
Unknown Object (File)
Sat, Apr 12, 11:05 PM
Unknown Object (File)
Fri, Apr 11, 7:20 PM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 63464
Build 60348: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Fri, Apr 11, 5:57 PM

I don't know why, but I got the new error after applying the change in D49787 (which makes no sense to me, I would have expected to have seen this error before regardless).

Hmm, I'm getting this on stock main it seems so will push it to fix the build.

This revision was not accepted when it landed; it landed in state Needs Review.Fri, Apr 11, 7:17 PM
This revision was automatically updated to reflect the committed changes.