]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
timesyncd: avoid signed/unsigned comparison (#7842) 7264/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 10 Jan 2018 10:35:00 +0000 (11:35 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 10 Jan 2018 10:35:00 +0000 (11:35 +0100)
be32toh() returns uint32_t, and m->trans_time.tv_nsec is defined as long in struct timespec.
Let's add a cast to avoid the warning.

Fixes #7789.

src/timesync/timesyncd-manager.c

index 8bd111fe0cbc68a7a8ce08025e629bcf4ef49148..a6d336c46156e1dfd8decebcce0387e55878012a 100644 (file)
@@ -552,7 +552,7 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re
 
         /* check our "time cookie" (we just stored nanoseconds in the fraction field) */
         if (be32toh(ntpmsg.origin_time.sec) != m->trans_time.tv_sec + OFFSET_1900_1970 ||
-            be32toh(ntpmsg.origin_time.frac) != m->trans_time.tv_nsec) {
+            be32toh(ntpmsg.origin_time.frac) != (unsigned long) m->trans_time.tv_nsec) {
                 log_debug("Invalid reply; not our transmit time. Ignoring.");
                 return 0;
         }