From dcfeee5eb0c445a297445cd371a6ce1a4bd7a557 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 12 Jan 2009 19:37:58 +0000 Subject: Fix instrumentation so it reports atomic chunks as well as writing them. --- gpsd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'gpsd.c') 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), -- cgit v1.2.1