mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
Use qemuOpenFile in qemu_driver.c
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
This commit is contained in:
parent
849df2875d
commit
b4a40dd92d
@ -9786,6 +9786,7 @@ qemuDomainBlockPeek(virDomainPtr dom,
|
|||||||
void *buffer,
|
void *buffer,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
|
virQEMUDriverPtr driver = dom->conn->privateData;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
int fd = -1, ret = -1;
|
int fd = -1, ret = -1;
|
||||||
const char *actual;
|
const char *actual;
|
||||||
@ -9812,13 +9813,9 @@ qemuDomainBlockPeek(virDomainPtr dom,
|
|||||||
}
|
}
|
||||||
path = actual;
|
path = actual;
|
||||||
|
|
||||||
/* The path is correct, now try to open it and get its size. */
|
fd = qemuOpenFile(driver, vm, path, O_RDONLY, NULL, NULL);
|
||||||
fd = open(path, O_RDONLY);
|
if (fd == -1)
|
||||||
if (fd == -1) {
|
|
||||||
virReportSystemError(errno,
|
|
||||||
_("%s: failed to open"), path);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* Seek and read. */
|
/* Seek and read. */
|
||||||
/* NB. Because we configure with AC_SYS_LARGEFILE, off_t should
|
/* NB. Because we configure with AC_SYS_LARGEFILE, off_t should
|
||||||
@ -9979,12 +9976,9 @@ static int qemuDomainGetBlockInfo(virDomainPtr dom,
|
|||||||
path = disk->src;
|
path = disk->src;
|
||||||
|
|
||||||
/* The path is correct, now try to open it and get its size. */
|
/* The path is correct, now try to open it and get its size. */
|
||||||
fd = open(path, O_RDONLY);
|
fd = qemuOpenFile(driver, vm, path, O_RDONLY, NULL, NULL);
|
||||||
if (fd == -1) {
|
if (fd == -1)
|
||||||
virReportSystemError(errno,
|
|
||||||
_("failed to open path '%s'"), path);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* Probe for magic formats */
|
/* Probe for magic formats */
|
||||||
if (disk->format) {
|
if (disk->format) {
|
||||||
|
Loading…
Reference in New Issue
Block a user