]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r299577, r299578, r299589
authortruckman <truckman@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Fri, 20 May 2016 06:24:16 +0000 (06:24 +0000)
committertruckman <truckman@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Fri, 20 May 2016 06:24:16 +0000 (06:24 +0000)
commit80a7f16229f243ba331a7970d3f864d3e975fd82
tree4d82feb77ac13526f64f0d8944abd19796e986a5
parenta45dbedd6f58318e4c78c6522922017eba147952
MFC r299577, r299578, r299589

r299577 | truckman | 2016-05-12 16:14:31 -0700 (Thu, 12 May 2016) | 15 lines

Avoid Coverity NUL termination warning about strncpy() by using
memcpy() instead.  It's probably a bit more optimal in this case
anyway. [1]

The program logic leading up to the creation of the strncpy/memcpy
destination buffer is a bit hairy.  Add a call to assert() to make
it clear what is happening here and detect any potential buffer
overruns in the future.

Check a couple syscall error returns.  Ignore the EEXIST error from
link() to preserve existing behavior. [2] [3]

r299578 | truckman | 2016-05-12 16:37:58 -0700 (Thu, 12 May 2016) | 2 lines

If fchdir() fails, call err() instead of warn().

r299589 | truckman | 2016-05-12 22:49:02 -0700 (Thu, 12 May 2016) | 4 lines

Instead of ignoring the EEXIST from link(), unconditionally unlink
the terget before calling link().  This should prevent links to an
old copy of the file from being retained.

Reported by: Coverity
CID: 1009659 [1], 1009349 [2], 1009350 [3]

git-svn-id: svn://svn.freebsd.org/base/stable/10@300269 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
usr.bin/catman/catman.c