diff options
author | Fred Wright <fw@fwright.net> | 2016-09-16 18:18:27 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2016-09-22 16:56:26 -0700 |
commit | 89bc05db05ec3f8f073852a46caa5b37ed87e2e1 (patch) | |
tree | a77a8f5d65b1a4c5f1999ac1905cf73003bbabef /drivers.c | |
parent | 21eb174671474947688c5afee8e92a637b2fb149 (diff) | |
download | gpsd-89bc05db05ec3f8f073852a46caa5b37ed87e2e1.tar.gz |
Fixes Ill-formed TOFF/PPS packet error in gpsmon.
The code for reporting the combined host address and device address
modifies the same 'path' field that it uses to form the combination
This was resulting in a growing accumulation of device names until the
string became too long. Although the way this code works could use
some improvement, a cheap fix is to check for the presence of the
device name in the path, and skip it when creating the new one.
TESTED:
On both OSX and Linux, ran "scons build-all check" and tested gpsmon
both with and without the -a option, verifying that it no longer
fails and that the reported "device" is the expected combined form.
Signed-off-by: Gary E. Miller <gem@rellim.com>
Diffstat (limited to 'drivers.c')
-rw-r--r-- | drivers.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1608,7 +1608,7 @@ static void path_rewrite(struct gps_device_t *session, char *prefix) * beginning of the path attribute, followed by a # to separate it * from the device. */ - char *prefloc; + char *prefloc, *sfxloc; assert(prefix != NULL && session->lexer.outbuffer != NULL); @@ -1628,6 +1628,8 @@ static void path_rewrite(struct gps_device_t *session, char *prefix) (void)strlcpy(prefloc, session->gpsdata.dev.path, sizeof(session->gpsdata.dev.path)); + if ((sfxloc = strchr(prefloc, '#'))) + *sfxloc = '\0'; /* Avoid accumulating multiple device names */ (void)strlcat((char *)session->lexer.outbuffer, "#", sizeof(session->lexer.outbuffer)); (void)strlcat((char *)session->lexer.outbuffer, |