Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/ntp/dist/ntpq using 2 casts to fix an unsigned-...



details:   https://anonhg.NetBSD.org/src/rev/606dd6f8b01f
branches:  trunk
changeset: 773484:606dd6f8b01f
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Feb 03 14:36:51 2012 +0000

description:
using 2 casts to fix an unsigned-signed comparison is a sign that this it
is done incorrectly. The RHS is guaranteed positive at this point so cast
it to unsigned to match the LHS.

diffstat:

 external/bsd/ntp/dist/ntpq/ntpq.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r aac654ba6d3d -r 606dd6f8b01f external/bsd/ntp/dist/ntpq/ntpq.c
--- a/external/bsd/ntp/dist/ntpq/ntpq.c Fri Feb 03 10:20:29 2012 +0000
+++ b/external/bsd/ntp/dist/ntpq/ntpq.c Fri Feb 03 14:36:51 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ntpq.c,v 1.7 2012/02/03 10:20:29 kardel Exp $  */
+/*     $NetBSD: ntpq.c,v 1.8 2012/02/03 14:36:51 christos Exp $        */
 
 /*
  * ntpq - query an NTP server using mode 6 commands
@@ -1080,7 +1080,7 @@
 
                if (debug >= 2)
                        printf("Got packet, size = %d\n", n);
-               if ((int)count > (n - (int)CTL_HEADER_LEN)) {
+               if (count > (u_int)(n - CTL_HEADER_LEN)) {
                        if (debug)
                                printf("Received count of %d octets, "
                                        "data in packet is %u\n",



Home | Main Index | Thread Index | Old Index