diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-09-29 01:42:45 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-09-29 01:46:53 -0400 |
commit | 4361ec2d89bdf451602d659ddfd0fb9a79c178a2 (patch) | |
tree | af067d1d7614a9e67f449eec933ba3347cde10b0 /gpsmon.c | |
parent | a77b95b57475c2856707e91b197f8aaa8e5eb407 (diff) | |
download | gpsd-4361ec2d89bdf451602d659ddfd0fb9a79c178a2.tar.gz |
Change gpsd_report to no longer use a global. All regression tests pass.
This is a large, ugly change. But without it we can't troubleshoot the
ICP/IP-source initialization bug properly - colliding definitions of
gpsd_report() were interfering with error reporting early in gpsd runs.
More cleanup work remains to be done, but at least this is working.
Diffstat (limited to 'gpsmon.c')
-rw-r--r-- | gpsmon.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -158,7 +158,7 @@ static void visibilize(/*@out@*/char *buf2, size_t len, const char *buf) 0x00ff & (unsigned)*sp); } -void gpsd_report(int errlevel, const char *fmt, ...) +void gpsd_report(const int debuglevel, const int errlevel, const char *fmt, ...) /* our version of the logger */ { char buf[BUFSIZ]; @@ -198,7 +198,7 @@ void gpsd_report(int errlevel, const char *fmt, ...) (void)strlcpy(buf, "gpsd:", BUFSIZ); (void)strncat(buf, err_str, BUFSIZ - strlen(buf) ); - if (errlevel <= context.debug && packetwin != NULL) { + if (errlevel <= debuglevel && packetwin != NULL) { char buf2[BUFSIZ]; va_list ap; va_start(ap, fmt); @@ -243,7 +243,7 @@ static ssize_t readpkt(void) /* conditional prevents mask dumper from eating CPU */ if (context.debug >= LOG_DATA) - gpsd_report(LOG_DATA, + gpsd_report(context.debug, LOG_DATA, "packet mask = %s\n", gps_maskdump(session.gpsdata.set)); @@ -598,7 +598,7 @@ int main(int argc, char **argv) (void)strlcpy(session.gpsdata.dev.path, argv[optind], sizeof(session.gpsdata.dev.path)); if (gpsd_activate(&session) == -1) { - gpsd_report(LOG_ERROR, + gpsd_report(context.debug, LOG_ERROR, "activation of device %s failed, errno=%d\n", session.gpsdata.dev.path, errno); exit(EXIT_FAILURE); |