summaryrefslogtreecommitdiff
path: root/gpsctl.c
diff options
context:
space:
mode:
authorKian Karas <kk@thrane.eu>2018-10-04 13:17:51 +0200
committerGary E. Miller <gem@rellim.com>2018-12-04 14:21:48 -0800
commit1467a240901544bf0fdb446f4cd4726a9346891f (patch)
treeb68687cc5855929be1da3124ecfb2360169c6516 /gpsctl.c
parent0d44bc6185a5e50bbdae2ab89e44757f3750a961 (diff)
downloadgpsd-1467a240901544bf0fdb446f4cd4726a9346891f.tar.gz
gpsctl: fix busy loop waiting for device
Signed-off-by: Gary E. Miller <gem@rellim.com>
Diffstat (limited to 'gpsctl.c')
-rw-r--r--gpsctl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gpsctl.c b/gpsctl.c
index 57fb4693..737a30e2 100644
--- a/gpsctl.c
+++ b/gpsctl.c
@@ -436,6 +436,12 @@ int main(int argc, char **argv)
}
while (devcount > 0) {
+ /* Wait for input data */
+ if (!gps_waiting(&gpsdata, timeout * 1000000)) {
+ gpsd_log(&context.errout, LOG_ERROR, "timed out waiting for device\n");
+ (void)gps_close(&gpsdata);
+ exit(EXIT_FAILURE);
+ }
errno = 0;
if (gps_read(&gpsdata, NULL, 0) == -1) {
gpsd_log(&context.errout, LOG_ERROR, "data read failed.\n");