summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-05-25 15:42:02 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-06-01 19:26:00 +0100
commit5a01a276331d7ad2bd70970e034ba94c09f26223 (patch)
tree79d8f9046b5b6c0b1903ac62fb32d13e5cb76187 /src
parent42e5cb2131bec39586a286a460f6c78f30d2ad8c (diff)
downloadlibguestfs-5a01a276331d7ad2bd70970e034ba94c09f26223.tar.gz
libguestfs-5a01a276331d7ad2bd70970e034ba94c09f26223.tar.xz
libguestfs-5a01a276331d7ad2bd70970e034ba94c09f26223.zip
trace: Fix display of non-printing characters.
Previously the code would drop the first character in any sequence of non-printing characters that occurred within a string. Fix for commit e6f18c59d577dd0b443bc6a1d76f699c4e0dde9f. (cherry picked from commit 73071b3163774ff9a514a05bc8e6fb35fa910787)
Diffstat (limited to 'src')
-rw-r--r--src/events.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/events.c b/src/events.c
index aa097295..a82b3f63 100644
--- a/src/events.c
+++ b/src/events.c
@@ -161,6 +161,11 @@ guestfs___call_callbacks_message (guestfs_h *g, uint64_t event,
while (i < buf_len && NO_ESCAPING (buf[i]))
++i;
fwrite (&buf[i0], 1, i-i0, stderr);
+ /* Adjust i so that next time around the loop, the next
+ * non-printing character will be displayed.
+ */
+ if (i < buf_len)
+ --i;
} else {
switch (buf[i]) {
case '\0': fputs ("\\0", stderr); break;