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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]