iohelper: Don't report errors on special FDs

Some FDs may not implement fdatasync() functionality,
e.g.  pipes. In that case EINVAL or EROFS is returned.
We don't want to fail then nor report any error.

Reported-by: Christophe Fergeau <cfergeau@redhat.com>
This commit is contained in:
Michal Privoznik 2012-11-05 15:42:53 +01:00
parent b27b712c24
commit 46325e5131

View File

@ -181,8 +181,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 (errno != EINVAL && errno != EROFS) {
/* fdatasync() may fail on some special FDs, e.g. pipes */
virReportSystemError(errno, _("unable to fsync %s"), fdoutname);
goto cleanup;
}
}
ret = 0;