]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
util: simplify clamping in UTI_TimespecNetworkToHost()
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 15 Aug 2017 08:53:02 +0000 (10:53 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 15 Aug 2017 11:27:50 +0000 (13:27 +0200)
This should fix a coverity warning.

util.c

diff --git a/util.c b/util.c
index 6803c02844cb8461cdbc7eedaaebcb41bf85b1d8..be47f1c4657657285ecba2dc62b2b3df04f19c15 100644 (file)
--- a/util.c
+++ b/util.c
@@ -856,7 +856,7 @@ UTI_TimespecNetworkToHost(Timespec *src, struct timespec *dest)
 #endif
 
   nsec = ntohl(src->tv_nsec);
-  dest->tv_nsec = CLAMP(0U, nsec, 999999999U);
+  dest->tv_nsec = MIN(nsec, 999999999U);
 }
 
 /* ================================================== */