From 618e504d30d493992f84a570218ee33774a58066 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Tue, 26 Jan 2016 14:21:40 +0100 Subject: [PATCH] actually use HAVE_FDATASYNC --- bin/xbps-create/main.c | 4 ++++ bin/xbps-rindex/repoflush.c | 4 ++++ lib/package_script.c | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/bin/xbps-create/main.c b/bin/xbps-create/main.c index 6c60d2e9..c5ca2acd 100644 --- a/bin/xbps-create/main.c +++ b/bin/xbps-create/main.c @@ -954,7 +954,11 @@ main(int argc, char **argv) */ binpkg = xbps_xasprintf("%s.%s.xbps", pkgver, arch); +#ifdef HAVE_FDATASYNC (void)fdatasync(pkg_fd); +#else + (void)fsync(pkg_fd); +#endif myumask = umask(0); (void)umask(myumask); diff --git a/bin/xbps-rindex/repoflush.c b/bin/xbps-rindex/repoflush.c index 0b56a95e..650e15fe 100644 --- a/bin/xbps-rindex/repoflush.c +++ b/bin/xbps-rindex/repoflush.c @@ -86,7 +86,11 @@ repodata_flush(struct xbps_handle *xhp, const char *repodir, /* Write data to tempfile and rename */ archive_write_finish(ar); +#ifdef HAVE_FDATASYNC fdatasync(repofd); +#else + fsync(repofd); +#endif assert(fchmod(repofd, 0664) != -1); close(repofd); rename(tname, repofile); diff --git a/lib/package_script.c b/lib/package_script.c index d44a7cd2..9280601d 100644 --- a/lib/package_script.c +++ b/lib/package_script.c @@ -87,7 +87,11 @@ xbps_pkg_exec_buffer(struct xbps_handle *xhp, goto out; } fchmod(fd, 0750); +#ifdef HAVE_FDATASYNC fdatasync(fd); +#else + fsync(fd); +#endif close(fd); /* exec script */