summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-09-17 08:48:43 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-09-17 08:48:43 +0000
commit9cdbb998794f19a64b5597002cbf8ade0938357a (patch)
tree959a565eff9ecfa9c4602dfb3431fe102b8f894c
parentb7061f11db8ed4bbfe68a5638cd36a0282fead25 (diff)
downloadgpsd-9cdbb998794f19a64b5597002cbf8ade0938357a.tar.gz
Suppress excess \r\n in ?DEVICES output.
-rw-r--r--gpsd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gpsd.c b/gpsd.c
index f0039dd1..32a797ce 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -1618,8 +1618,12 @@ static void json_devicelist_dump(char *reply, size_t replylen)
"{\"class\":\"DEVICES\",\"devices\":[", replylen);
for (devp = devices; devp < devices + MAXDEVICES; devp++)
if (allocated_device(devp) && strlen(reply)+strlen(devp->gpsdata.dev.path)+3 < replylen-1) {
+ char *cp;
json_device_dump(devp,
reply+strlen(reply), replylen-strlen(reply));
+ cp = reply + strlen(reply);
+ *--cp = '\0';
+ *--cp = '\0';
(void)strlcat(reply, ",", replylen);
}