]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
util: handle NaN in UTI_FloatHostToNetwork()
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 18 May 2015 13:50:07 +0000 (15:50 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 18 May 2015 13:51:32 +0000 (15:51 +0200)
util.c

diff --git a/util.c b/util.c
index 8141e58481d9c3a1eb07058e38e0bd8a15bde034..db59c60dd7e43fe483e0fe1be427a582cc659250 100644 (file)
--- a/util.c
+++ b/util.c
@@ -707,7 +707,11 @@ UTI_FloatHostToNetwork(double x)
   if (x < 0.0) {
     x = -x;
     neg = 1;
+  } else if (x >= 0.0) {
+    neg = 0;
   } else {
+    /* Save NaN as zero */
+    x = 0.0;
     neg = 0;
   }