[libvirt] [PATCH] qemu: only report errno in trace message on failure

Daniel P. Berrange berrange at redhat.com
Tue Aug 2 10:48:42 UTC 2016


Avoid reporting a stale errno value when the syscall succeeds,
instead always pass 0.

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 src/qemu/qemu_monitor.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 58c04d5..6c9695e 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -528,12 +528,12 @@ qemuMonitorIOWrite(qemuMonitorPtr mon)
 
     PROBE(QEMU_MONITOR_IO_WRITE,
           "mon=%p buf=%s len=%zu ret=%d errno=%d",
-          mon, buf, len, done, errno);
+          mon, buf, len, done, done < 0 ? errno : 0);
 
     if (mon->msg->txFD != -1) {
         PROBE(QEMU_MONITOR_IO_SEND_FD,
               "mon=%p fd=%d ret=%d errno=%d",
-              mon, mon->msg->txFD, done, errno);
+              mon, mon->msg->txFD, done, done < 0 ? errno : 0);
     }
 
     if (done < 0) {
-- 
2.7.4




More information about the libvir-list mailing list