]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Use qemuOpenFile in qemu_driver.c
authorMartin Kletzander <mkletzan@redhat.com>
Fri, 24 May 2013 16:26:26 +0000 (18:26 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Wed, 24 Jul 2013 12:29:12 +0000 (14:29 +0200)
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

src/qemu/qemu_driver.c

index 023f0912b115e590724cdfd3409d6410cb960d2a..2adf6e2c607eb1f1c28d95f5d18885cbce76f9f9 100644 (file)
@@ -9786,6 +9786,7 @@ qemuDomainBlockPeek(virDomainPtr dom,
                     void *buffer,
                     unsigned int flags)
 {
+    virQEMUDriverPtr driver = dom->conn->privateData;
     virDomainObjPtr vm;
     int fd = -1, ret = -1;
     const char *actual;
@@ -9812,13 +9813,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
@@ -9979,12 +9976,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) {