summaryrefslogtreecommitdiff
path: root/gpsd.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-01-12 19:37:58 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-01-12 19:37:58 +0000
commitdcfeee5eb0c445a297445cd371a6ce1a4bd7a557 (patch)
treeb85a019087edaabc3606b26e786c5eb272e76e49 /gpsd.c
parent63ac5d9f19b80a72939cb9b9c369f0815cd35e64 (diff)
downloadgpsd-dcfeee5eb0c445a297445cd371a6ce1a4bd7a557.tar.gz
Fix instrumentation so it reports atomic chunks as well as writing them.
Diffstat (limited to 'gpsd.c')
-rw-r--r--gpsd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gpsd.c b/gpsd.c
index d813cd02..cf90e7f7 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -454,10 +454,11 @@ static ssize_t throttled_write(struct subscriber_t *sub, char *buf, ssize_t len)
chunklen = chunkend - chunk + 1;
if (debuglevel >= 3) {
- if (isprint(chunk[0]))
- gpsd_report(LOG_IO, "=> client(%d): %s", sub_index(sub), chunk);
- else {
- char *cp, chunk2[MAX_PACKET_LENGTH*3];
+ char *cp, chunk2[MAX_PACKET_LENGTH*3];
+ if (isprint(chunk[0])) {
+ (void)strlcpy(chunk2, chunk, chunklen);
+ gpsd_report(LOG_IO, "=> client(%d): %s", sub_index(sub), chunk2);
+ } else {
chunk2[0] = '\0';
for (cp = chunk; cp < chunk + chunklen; cp++)
(void)snprintf(chunk2 + strlen(chunk2),