[PATCH 3/3] Use qemuOpenFile in qemu_driver.c

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

 



On two places, the usage of open() is replaced with qemuOpenFile as
that is the preferred method in those cases.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=963881

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 87dedef..a08a72a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -9165,6 +9165,7 @@ qemuDomainBlockPeek(virDomainPtr dom,
                     void *buffer,
                     unsigned int flags)
 {
+    virQEMUDriverPtr driver = dom->conn->privateData;
     virDomainObjPtr vm;
     int fd = -1, ret = -1;
     const char *actual;
@@ -9188,13 +9189,9 @@ qemuDomainBlockPeek(virDomainPtr dom,
     }
     path = actual;

-    /* The path is correct, now try to open it and get its size. */
-    fd = open(path, O_RDONLY);
-    if (fd == -1) {
-        virReportSystemError(errno,
-                             _("%s: failed to open"), path);
+    fd = qemuOpenFile(driver, vm, path, O_RDONLY, NULL, NULL);
+    if (fd == -1)
         goto cleanup;
-    }

     /* Seek and read. */
     /* NB. Because we configure with AC_SYS_LARGEFILE, off_t should
@@ -9351,12 +9348,9 @@ static int qemuDomainGetBlockInfo(virDomainPtr dom,
     path = disk->src;

     /* The path is correct, now try to open it and get its size. */
-    fd = open(path, O_RDONLY);
-    if (fd == -1) {
-        virReportSystemError(errno,
-                             _("failed to open path '%s'"), path);
+    fd = qemuOpenFile(driver, vm, path, O_RDONLY, NULL, NULL);
+    if (fd == -1)
         goto cleanup;
-    }

     /* Probe for magic formats */
     if (disk->format) {
-- 
1.8.2.1

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