We are requesting for stderr catching for all cases in
virFileWrapperFdNew(). There is no need to have a separate
function just to report an error, esp. when we can do it in
virFileWrapperFdClose().
---
src/libvirt_private.syms | 1 -
src/qemu/qemu_driver.c | 5 +----
src/util/virfile.c | 21 ++++++---------------
src/util/virfile.h | 2 --
4 files changed, 7 insertions(+), 22 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 57e3eb4..a9560ba 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1382,7 +1382,6 @@ virFileLoopDeviceAssociate;
virFileRewrite;
virFileTouch;
virFileUpdatePerm;
-virFileWrapperFdCatchError;
virFileWrapperFdClose;
virFileWrapperFdFree;
virFileWrapperFdNew;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e10fc89..abd7eec 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2864,7 +2864,6 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
cleanup:
VIR_FORCE_CLOSE(fd);
- virFileWrapperFdCatchError(wrapperFd);
virFileWrapperFdFree(wrapperFd);
VIR_FREE(xml);
@@ -3307,10 +3306,8 @@ doCoreDump(virQEMUDriverPtr driver,
cleanup:
VIR_FORCE_CLOSE(fd);
- if (ret != 0) {
- virFileWrapperFdCatchError(wrapperFd);
+ if (ret != 0)
unlink(path);
- }
virFileWrapperFdFree(wrapperFd);
return ret;
}
diff --git a/src/util/virfile.c b/src/util/virfile.c
index bb33801..041c804 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -286,26 +286,17 @@ virFileWrapperFdNew(int *fd ATTRIBUTE_UNUSED,
int
virFileWrapperFdClose(virFileWrapperFdPtr wfd)
{
+ int ret;
+
if (!wfd)
return 0;
- return virCommandWait(wfd->cmd, NULL);
-}
-
-
-/**
- * virFileWrapperFdCatchError:
- * @wfd: fd wrapper, or NULL
- *
- * If iohelper reported any error VIR_WARN() about it.
- */
-void
-virFileWrapperFdCatchError(virFileWrapperFdPtr wfd)
-{
- if (wfd && wfd->err_msg)
+ ret = virCommandWait(wfd->cmd, NULL);
+ if (wfd->err_msg)
VIR_WARN("iohelper reports: %s", wfd->err_msg);
-}
+ return ret;
+}
/**
* virFileWrapperFdFree:
diff --git a/src/util/virfile.h b/src/util/virfile.h
index 80daf86..c885b73 100644
--- a/src/util/virfile.h
+++ b/src/util/virfile.h
@@ -90,8 +90,6 @@ int virFileWrapperFdClose(virFileWrapperFdPtr dfd);
void virFileWrapperFdFree(virFileWrapperFdPtr dfd);
-void virFileWrapperFdCatchError(virFileWrapperFdPtr dfd);
-
int virFileLock(int fd, bool shared, off_t start, off_t len);
int virFileUnlock(int fd, off_t start, off_t len);
--
1.8.0.2