From: Juergen Perlinger Date: Thu, 21 Aug 2014 16:17:07 +0000 (+0200) Subject: refclock_gpsdjson: Fix coverity warning. Did not cause a bug, but the code was not... X-Git-Tag: NTP_4_2_7P464~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f068eb69d6d3f5d79e4bf6171515c83169ee2bde;p=thirdparty%2Fntp.git refclock_gpsdjson: Fix coverity warning. Did not cause a bug, but the code was not excatly as intented. bk: 53f61b83Apc7Y157QN9bhgOQ-aEOMQ --- diff --git a/ntpd/refclock_gpsdjson.c b/ntpd/refclock_gpsdjson.c index 1a235621a..e42dd2011 100644 --- a/ntpd/refclock_gpsdjson.c +++ b/ntpd/refclock_gpsdjson.c @@ -486,11 +486,16 @@ gpsd_timer( * because the reply will initiate a new watch request * cycle. */ - if (-1 != pp->io.fd && !up->fl_watch) { - DPRINTF(2, ("GPSD_JSON(%d): timer livecheck: '%s'\n", - up->unit, query)); - rc = write(pp->io.fd, query, sizeof(query)); - (void)rc; + if (-1 != pp->io.fd) { + if ( ! up->fl_watch) { + DPRINTF(2, ("GPSD_JSON(%d): timer livecheck: '%s'\n", + up->unit, query)); + rc = write(pp->io.fd, + query, sizeof(query)); + (void)rc; + } + } else if (-1 != up->fdt) { + gpsd_test_socket(peer); } break; @@ -501,6 +506,7 @@ gpsd_timer( gpsd_test_socket(peer); else if (NULL != s_gpsd_addr) gpsd_init_socket(peer); + break; default: if (-1 == pp->io.fd && -1 != up->fdt)