[libvirt] [PATCH] qemudOpenMonitor: fix open(2) error check

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

 



Hi,
open returns -1 on failure. Pointed out by Guido Trotter on:

http://bugs.debian.org/492250

Patch against current CVS attached.
 -- Guido
 
---
 src/qemu_driver.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 8015b63..2539d78 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -505,7 +505,7 @@ static int qemudOpenMonitor(virConnectPtr conn,
     char buf[1024];
     int ret = -1;
 
-    if (!(monfd = open(monitor, O_RDWR))) {
+    if ((monfd = open(monitor, O_RDWR)) < 0) {
         qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          _("Unable to open monitor path %s"), monitor);
         return -1;
-- 
1.5.6.3

--
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]