]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix up r316081 by using nitems(cam_errbuf) instead of sizeof(cam_errbuf)
authorngie <ngie@FreeBSD.org>
Wed, 29 Mar 2017 08:38:31 +0000 (08:38 +0000)
committerngie <ngie@FreeBSD.org>
Wed, 29 Mar 2017 08:38:31 +0000 (08:38 +0000)
commit1d095aec58a53452b36c380c3ef26cf2a556e3e2
tree2459274acaa90b9bda287f63ef3fb50cbeba3e9f
parentd3e56841f6f1929ef1abbb22ec18f62b1203b4b3
Fix up r316081 by using nitems(cam_errbuf) instead of sizeof(cam_errbuf)

Part of my original reasoning as far as converting the snprintf
calls was to permit switching over from char[] to wchar_t[] in the
future, as well as futureproof in case cam_errbuf's size was ever
changed.

Unfortunately, my approach was bugged because it conflated the
number of items with the size of the buffer, instead of the number of
elements being a fixed size != 1 byte.

Use nitems(..) instead which counts the quantity of items of a specific
type, as opposed to an unqualified sizeof(..) (which assumes that the
number of characters is equal to the buffer size).

MFC after: 2 months
Noted by: cem
Sponsored by: Dell EMC Isilon
lib/libcam/camlib.c