]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
refclock_gpsdjson: Fix coverity warning. Did not cause a bug, but the code was not...
authorJuergen Perlinger <perlinger@ntp.org>
Thu, 21 Aug 2014 16:17:07 +0000 (18:17 +0200)
committerJuergen Perlinger <perlinger@ntp.org>
Thu, 21 Aug 2014 16:17:07 +0000 (18:17 +0200)
bk: 53f61b83Apc7Y157QN9bhgOQ-aEOMQ

ntpd/refclock_gpsdjson.c

index 1a235621acb17773297c0849c6290dac2ddc2ccb..e42dd201112dc828c98695bb62bd73bff8d93777 100644 (file)
@@ -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)