After upgrading to libvirt 1.0.0, I've started getting warnings
from libvirt:
(gnome-boxes:5965): Libvirt.GObject-CRITICAL **: cannot finish stream:
internal error libvirt_iohelper: unable to fsync stdout: Invalid argument
On further investigation, in iohelper.c:runIO(), fdatasync can get called
on STDOUT_FILENO, which indeed returns EINVAL when this happens. After
making sure that fdout is not STDOUT_FILENO, this warning goes away.
---
src/util/iohelper.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/util/iohelper.c b/src/util/iohelper.c
index 860e14a..f8a8ee3 100644
--- a/src/util/iohelper.c
+++ b/src/util/iohelper.c
@@ -180,9 +180,11 @@ runIO(const char *path, int fd, int oflags, unsigned long long
length)
}
/* Ensure all data is written */
- if (fdatasync(fdout) < 0) {
- virReportSystemError(errno, _("unable to fsync %s"), fdoutname);
- goto cleanup;
+ if (fdout != STDOUT_FILENO) {
+ if (fdatasync(fdout) < 0) {
+ virReportSystemError(errno, _("unable to fsync %s"), fdoutname);
+ goto cleanup;
+ }
}
ret = 0;
--
1.7.12.1