From: Daniel P. BerrangĂ© Date: Fri, 20 Dec 2019 15:57:24 +0000 (+0000) Subject: src: use g_fsync for portability X-Git-Tag: v6.0.0-rc1~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dac174ee07e8ce20aa0b6f21cb8d3b0c9302c0cb;p=thirdparty%2Flibvirt.git src: use g_fsync for portability The g_fsync() API provides the same Windows portability as GNULIB does for fsync(). Reviewed-by: Fabiano FidĂȘncio Signed-off-by: Daniel P. BerrangĂ© --- diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c index 9514dfd75c..9a71d13d57 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -1772,7 +1772,7 @@ virNWFilterSnoopLeaseFileWrite(int lfd, const char *ifkey, goto cleanup; } - ignore_value(fsync(lfd)); + ignore_value(g_fsync(lfd)); cleanup: VIR_FREE(lbuf); diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index f2d8810813..c1a6b44f4b 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -384,7 +384,7 @@ createRawFile(int fd, virStorageVolDefPtr vol, } } - if (fsync(fd) < 0) { + if (g_fsync(fd) < 0) { ret = -errno; virReportSystemError(errno, _("cannot sync data to file '%s'"), vol->target.path); diff --git a/src/util/virfile.c b/src/util/virfile.c index 0f0d607c59..1784895575 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -519,7 +519,7 @@ virFileRewrite(const char *path, goto cleanup; } - if (fsync(fd) < 0) { + if (g_fsync(fd) < 0) { virReportSystemError(errno, _("cannot sync file '%s'"), newfile); goto cleanup;