summaryrefslogtreecommitdiff
path: root/drivers.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-11-17 07:49:50 -0500
committerEric S. Raymond <esr@thyrsus.com>2013-11-17 07:49:50 -0500
commitb9732abae7857c5873eec7fbd96924c2403e4a0f (patch)
tree8a923d730c937ddeea5af3d222bcec1c484de0af /drivers.c
parent881be972b47712a69a8b433652fe407717c09331 (diff)
downloadgpsd-b9732abae7857c5873eec7fbd96924c2403e4a0f.tar.gz
Suppress path rewrites in one important special case.
Diffstat (limited to 'drivers.c')
-rw-r--r--drivers.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/drivers.c b/drivers.c
index b25fa7b3..f6b9ee04 100644
--- a/drivers.c
+++ b/drivers.c
@@ -1433,27 +1433,30 @@ 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 */
- if (strstr((char *)session->packet.outbuffer, "DEVICE") != NULL)
- path_rewrite(session, "\"path\":\"");
- path_rewrite(session, "\"device\":\"");
-
- /* mark certain responses without a path or device attribute */
- if (session->gpsdata.dev.path[0] != '\0') {
- if (strstr((char *)session->packet.outbuffer, "VERSION") != NULL
- || strstr((char *)session->packet.outbuffer, "WATCH") != NULL
- || strstr((char *)session->packet.outbuffer, "DEVICES") != NULL) {
- session->packet.outbuffer[session->packet.outbuflen-1] = '\0';
- (void)strlcat((char *)session->packet.outbuffer, ",\"remote\":\"",
- sizeof(session->packet.outbuffer));
- (void)strlcat((char *)session->packet.outbuffer,
- session->gpsdata.dev.path,
- sizeof(session->packet.outbuffer));
- (void)strlcat((char *)session->packet.outbuffer, "\"}",
- sizeof(session->packet.outbuffer));
+ if (strncmp(session->gpsdata.dev.path, "gpsd://localhost:", 17) != 0)
+ {
+ /*@-nullpass@*/ /* required only because splint is buggy */
+ /* devices and paths need to be edited */
+ if (strstr((char *)session->packet.outbuffer, "DEVICE") != NULL)
+ path_rewrite(session, "\"path\":\"");
+ path_rewrite(session, "\"device\":\"");
+
+ /* mark certain responses without a path or device attribute */
+ if (session->gpsdata.dev.path[0] != '\0') {
+ if (strstr((char *)session->packet.outbuffer, "VERSION") != NULL
+ || strstr((char *)session->packet.outbuffer, "WATCH") != NULL
+ || strstr((char *)session->packet.outbuffer, "DEVICES") != NULL) {
+ session->packet.outbuffer[session->packet.outbuflen-1] = '\0';
+ (void)strlcat((char *)session->packet.outbuffer, ",\"remote\":\"",
+ sizeof(session->packet.outbuffer));
+ (void)strlcat((char *)session->packet.outbuffer,
+ session->gpsdata.dev.path,
+ sizeof(session->packet.outbuffer));
+ (void)strlcat((char *)session->packet.outbuffer, "\"}",
+ sizeof(session->packet.outbuffer));
+ }
+ session->packet.outbuflen = strlen((char *)session->packet.outbuffer);
}
- session->packet.outbuflen = strlen((char *)session->packet.outbuffer);
}
gpsd_report(session->context->debug, LOG_PROG,
"JSON, passing through %s\n",