]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: driver: Fix usage of qemuOpenFile
authorPeter Krempa <pkrempa@redhat.com>
Wed, 10 May 2017 10:33:19 +0000 (12:33 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 10 May 2017 13:48:19 +0000 (15:48 +0200)
The function returns -errno on failure, not only -1.

src/qemu/qemu_driver.c

index 92ef983ae48a157c47461f2b165e8eeb2075cb00..1c4873e4858f12bd2bbcf5592064d6c792992258 100644 (file)
@@ -11189,7 +11189,7 @@ qemuDomainBlockPeek(virDomainPtr dom,
     path = actual;
 
     fd = qemuOpenFile(driver, vm, path, O_RDONLY, NULL, NULL);
-    if (fd == -1)
+    if (fd < 0)
         goto cleanup;
 
     /* Seek and read. */
@@ -11327,7 +11327,7 @@ qemuDomainStorageOpenStat(virQEMUDriverPtr driver,
 {
     if (virStorageSourceIsLocalStorage(src)) {
         if ((*ret_fd = qemuOpenFile(driver, vm, src->path, O_RDONLY,
-                                    NULL, NULL)) == -1)
+                                    NULL, NULL)) < 0)
             return -1;
 
         if (fstat(*ret_fd, ret_sb) < 0) {