[libvirt] [PATCH 08/23] src: use g_fsync for portability

Daniel P. Berrangé berrange at redhat.com
Thu Jan 2 14:53:42 UTC 2020


The g_fsync() API provides the same Windows portability
as GNULIB does for fsync().

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 src/nwfilter/nwfilter_dhcpsnoop.c | 2 +-
 src/storage/storage_util.c        | 2 +-
 src/util/virfile.c                | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

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;
-- 
2.24.1




More information about the libvir-list mailing list