]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r274846:
authordim <dim@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 25 Nov 2014 12:19:05 +0000 (12:19 +0000)
committerdim <dim@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 25 Nov 2014 12:19:05 +0000 (12:19 +0000)
commit4a2dcd63774a76ff3d22917db5f9872cdb7935f0
tree3e5e2f7d5b890e10263d4c3b45b4c1873d646f87
parentff3f0adeeb08d42147823a3857af719158836f52
MFC r274846:

Fix the following -Werror warning from clang 3.5.0, while building
usr.bin/cpio on amd64 (or any arch with 64-bit time_t):

contrib/libarchive/cpio/cpio.c:1143:6: error: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
if (abs(mtime - now) > (365/2)*86400)
    ^
contrib/libarchive/cpio/cpio.c:1143:6: note: use function 'labs' instead
if (abs(mtime - now) > (365/2)*86400)
    ^~~
    labs
1 error generated.

This is because time_t is a long on amd64. To avoid the warning, just
copy the equivalent test from a few lines before, which is used in the
Windows case, and which is type safe.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D1198

git-svn-id: svn://svn.freebsd.org/base/stable/10@275031 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
contrib/libarchive/cpio/cpio.c