diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-01-12 19:37:58 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-01-12 19:37:58 +0000 |
commit | dcfeee5eb0c445a297445cd371a6ce1a4bd7a557 (patch) | |
tree | b85a019087edaabc3606b26e786c5eb272e76e49 /gpsd.c | |
parent | 63ac5d9f19b80a72939cb9b9c369f0815cd35e64 (diff) | |
download | gpsd-dcfeee5eb0c445a297445cd371a6ce1a4bd7a557.tar.gz |
Fix instrumentation so it reports atomic chunks as well as writing them.
Diffstat (limited to 'gpsd.c')
-rw-r--r-- | gpsd.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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), |