From: Daniel P. Berrange Date: Tue, 2 Aug 2016 10:48:01 +0000 (+0100) Subject: qemu: only report errno in trace message on failure X-Git-Tag: v2.2.0-rc1~170 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9cf3c44ff5eda619405dfdbe6d614557baf30375;p=thirdparty%2Flibvirt.git qemu: only report errno in trace message on failure Avoid reporting a stale errno value when the syscall succeeds, instead always pass 0. Signed-off-by: Daniel P. Berrange --- diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 58c04d5318..6c9695e172 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) {