Code

src/liboping.c: Always set the QoS member. Default to 0.
authorFlorian Forster <octo@verplant.org>
Wed, 17 Nov 2010 08:01:19 +0000 (09:01 +0100)
committerFlorian Forster <octo@verplant.org>
Wed, 17 Nov 2010 08:01:19 +0000 (09:01 +0100)
This should fix the following warning / error:
  liboping.c:599: warning: comparison is always true due to limited
    range of data type

Thanks to James Bromberger for reporting this!

src/liboping.c

index a272e2cb92f7051ad964be0f20f67874fefc2b21..46168434d0c62046d0c9b4f07583009d050674d2 100644 (file)
@@ -499,7 +499,7 @@ static int ping_receive_one (pingobj_t *obj, const pinghost_t *ph,
 
        /* Iterate over all auxiliary data in msghdr */
        recv_ttl = -1;
-       recv_qos = 0xff;
+       recv_qos = 0;
        for (cmsg = CMSG_FIRSTHDR (&msghdr); /* {{{ */
                        cmsg != NULL;
                        cmsg = CMSG_NXTHDR (&msghdr, cmsg))
@@ -596,8 +596,7 @@ static int ping_receive_one (pingobj_t *obj, const pinghost_t *ph,
 
        if (recv_ttl >= 0)
                host->recv_ttl = recv_ttl;
-       if (recv_qos != 0xffff)
-               host->recv_qos = recv_qos;
+       host->recv_qos = recv_qos;
 
        host->latency  = ((double) diff.tv_usec) / 1000.0;
        host->latency += ((double) diff.tv_sec)  * 1000.0;