Directly check the return value of 'connect'. Unfortunately we can't remove it as we have to undo auto-closing of the socket on success. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_monitor.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index ad5e121359..0c0b07d4a5 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -245,8 +245,7 @@ qemuMonitorOpenUnix(const char *monitor) return -1; } - ret = connect(monfd, (struct sockaddr *) &addr, sizeof(addr)); - if (ret < 0) { + if (connect(monfd, (struct sockaddr *) &addr, sizeof(addr)) < 0) { virReportSystemError(errno, "%s", _("failed to connect to monitor socket")); return -1; -- 2.36.1