]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r316131:
authorngie <ngie@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 28 May 2017 00:47:02 +0000 (00:47 +0000)
committerngie <ngie@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 28 May 2017 00:47:02 +0000 (00:47 +0000)
commite5968ea76a28c49faea89719da92e4578c2bdf1e
tree2dcb34c8e7b87b3605cff7370f185529ad0ca6d8
parent3fa0e0243375575e4c88529045db4eb3389fceaf
MFC r316131:

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).

Noted by: cem

git-svn-id: svn://svn.freebsd.org/base/stable/10@319023 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
lib/libcam/camlib.c