summaryrefslogtreecommitdiff
path: root/gpsmon.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2015-04-02 16:45:00 -0700
committerGary E. Miller <gem@rellim.com>2015-04-02 16:45:00 -0700
commit93e95f91a7d5e6395aa6df82bb4059b411e89f9a (patch)
tree3ba282db06806757e24518e4bcbeb0b5626434eb /gpsmon.c
parent99c6d72cee7decd6001a88625c8613f376b9cbfe (diff)
downloadgpsd-93e95f91a7d5e6395aa6df82bb4059b411e89f9a.tar.gz
Stop infinite loop in gpsmon for /dev/pps0
Also fix debug output gsmon: -> gpsmon:
Diffstat (limited to 'gpsmon.c')
-rw-r--r--gpsmon.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gpsmon.c b/gpsmon.c
index 76f75354..7ef5648f 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -1146,9 +1146,10 @@ int main(int argc, char **argv)
volatile int maxfd = 0;
char inbuf[80];
volatile bool nocurses = false;
+ int activated = -1;
(void)putenv("TZ=UTC"); // for ctime()
- gps_context_init(&context, "gsmon"); // initialize the report mutex
+ gps_context_init(&context, "gpsmon"); // initialize the report mutex
context.serial_write = gpsmon_serial_write;
context.errout.report = gpsmon_report;
while ((option = getopt(argc, argv, "aD:LVhl:nt:?")) != -1) {
@@ -1275,10 +1276,11 @@ int main(int argc, char **argv)
"%s:%s", source.server, source.port);
}
- if (gpsd_activate(&session, O_PROBEONLY) == -1) {
- (void)fprintf(stderr,
- "gpsmon: activation of device %s failed, errno=%d (%s)\n",
- session.gpsdata.dev.path, errno, strerror(errno));
+ activated = gpsd_activate(&session, O_PROBEONLY);
+ if ( 0 > activated ) {
+ if ( PLACEHOLDING_FD == activated ) {
+ (void)fputs("gpsmon:ERROR: PPS device unsupported\n", stderr);
+ }
exit(EXIT_FAILURE);
}