From: Peter Krempa Date: Wed, 10 May 2017 10:33:19 +0000 (+0200) Subject: qemu: driver: Fix usage of qemuOpenFile X-Git-Tag: v3.4.0-rc1~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d1b93906c83844444d0278fdba00b14e814f662;p=thirdparty%2Flibvirt.git qemu: driver: Fix usage of qemuOpenFile The function returns -errno on failure, not only -1. --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 92ef983ae4..1c4873e485 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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) {