summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Jones <rjones@trick.home.annexia.org>2009-09-17 14:50:04 +0100
committerRichard Jones <rjones@trick.home.annexia.org>2009-09-17 16:01:52 +0100
commitbb02f0fbe80ef093731bc9a6a407f1edaccf991d (patch)
treeca2a93fd4e01c830c8c789b61ae104190caecd66 /src
parent5ccae24e06c52977f8b71d00c19f1100c1fa9c4c (diff)
downloadlibguestfs-bb02f0fbe80ef093731bc9a6a407f1edaccf991d.tar.gz
libguestfs-bb02f0fbe80ef093731bc9a6a407f1edaccf991d.tar.xz
libguestfs-bb02f0fbe80ef093731bc9a6a407f1edaccf991d.zip
Fix verbose packet dumping functions.
Add the configure parameter --enable-packet-dump so that this code can be enabled without editing the source. This code is normally commented out, because it is too verbose unless you happen to be debugging the underlying protocol. Because it is normally commented out, I found it had bit-rotted slightly. This commit also fixes the obvious problems.
Diffstat (limited to 'src')
-rw-r--r--src/guestfs.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/guestfs.c b/src/guestfs.c
index 17974fd3..8c05c40a 100644
--- a/src/guestfs.c
+++ b/src/guestfs.c
@@ -1900,20 +1900,20 @@ recv_from_daemon (guestfs_h *g, uint32_t *size_rtn, void **buf_rtn)
}
/* Got the full message, caller can start processing it. */
-#if 0
+#ifdef ENABLE_PACKET_DUMP
if (g->verbose) {
- size_t i, j;
+ ssize_t i, j;
for (i = 0; i < nr; i += 16) {
- printf ("%04x: ", i);
+ printf ("%04zx: ", i);
for (j = i; j < MIN (i+16, nr); ++j)
- printf ("%02x ", (unsigned char) (*buf_rtn)[j]);
+ printf ("%02x ", (*(unsigned char **)buf_rtn)[j]);
for (; j < i+16; ++j)
printf (" ");
printf ("|");
- for (j = i; j < MIN (i+16, g->nr); ++j)
- if (isprint ((*buf_rtn)[j]))
- printf ("%c", (*buf_rtn)[j]);
+ for (j = i; j < MIN (i+16, nr); ++j)
+ if (isprint ((*(char **)buf_rtn)[j]))
+ printf ("%c", (*(char **)buf_rtn)[j]);
else
printf (".");
for (; j < i+16; ++j)