summaryrefslogtreecommitdiff
path: root/drivers.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-11-07 07:05:35 -0500
committerEric S. Raymond <esr@thyrsus.com>2013-11-07 07:05:35 -0500
commitda16b5f3e379e89d30207b0fba92559e0f99e502 (patch)
tree4a9f67d50e486e1a298c6e8f1850939099c8ef6c /drivers.c
parent7d2389b9b492026e0b653e3eccdba89b0ee113b6 (diff)
downloadgpsd-da16b5f3e379e89d30207b0fba92559e0f99e502.tar.gz
Polish the JSON passthrough code, and add a regression test.
Diffstat (limited to 'drivers.c')
-rw-r--r--drivers.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers.c b/drivers.c
index 55f2bdc9..d7718006 100644
--- a/drivers.c
+++ b/drivers.c
@@ -1394,7 +1394,7 @@ static void path_rewrite(struct gps_device_t *session, char *prefix)
/*
* Hack the packet to reflect its origin. This code is supposed
* to insert the path naming the remote gpsd instance into the
- * baginning of the path attribute, followed by a # to separate it
+ * beginning of the path attribute, followed by a # to separate it
* from the device.
*/
char *prefloc;
@@ -1402,7 +1402,7 @@ static void path_rewrite(struct gps_device_t *session, char *prefix)
prefloc < (char *)session->packet.outbuffer+session->packet.outbuflen;
prefloc++)
if (strncmp(prefloc, prefix, strlen(prefix)) == 0) {
- char copy[sizeof(session->packet.outbuffer)];
+ char copy[sizeof(session->packet.outbuffer)+1];
(void)strlcpy(copy,
(char *)session->packet.outbuffer,
sizeof(copy));
@@ -1419,13 +1419,13 @@ static void path_rewrite(struct gps_device_t *session, char *prefix)
session->packet.outbuflen = strlen((char *)session->packet.outbuffer);
}
-static gps_mask_t json_pass_packet(struct gps_device_t *session UNUSED)
+static gps_mask_t json_pass_packet(struct gps_device_t *session)
{
gpsd_report(session->context->debug, LOG_IO,
"<= GPS: %s\n", (char *)session->packet.outbuffer);
/*@-nullpass@*/ /* required only because splint is buggy */
- /* devices and paths need to be edited to */
+ /* devices and paths need to be edited */
if (strstr((char *)session->packet.outbuffer, "DEVICE") != NULL)
path_rewrite(session, "\"path\":\"");
path_rewrite(session, "\"device\":\"");