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

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



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


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