actually use HAVE_FDATASYNC

This commit is contained in:
Michael Gehring 2016-01-26 14:21:40 +01:00
parent 0f56b68eac
commit 618e504d30
3 changed files with 12 additions and 0 deletions

View File

@ -954,7 +954,11 @@ main(int argc, char **argv)
*/ */
binpkg = xbps_xasprintf("%s.%s.xbps", pkgver, arch); binpkg = xbps_xasprintf("%s.%s.xbps", pkgver, arch);
#ifdef HAVE_FDATASYNC
(void)fdatasync(pkg_fd); (void)fdatasync(pkg_fd);
#else
(void)fsync(pkg_fd);
#endif
myumask = umask(0); myumask = umask(0);
(void)umask(myumask); (void)umask(myumask);

View File

@ -86,7 +86,11 @@ repodata_flush(struct xbps_handle *xhp, const char *repodir,
/* Write data to tempfile and rename */ /* Write data to tempfile and rename */
archive_write_finish(ar); archive_write_finish(ar);
#ifdef HAVE_FDATASYNC
fdatasync(repofd); fdatasync(repofd);
#else
fsync(repofd);
#endif
assert(fchmod(repofd, 0664) != -1); assert(fchmod(repofd, 0664) != -1);
close(repofd); close(repofd);
rename(tname, repofile); rename(tname, repofile);

View File

@ -87,7 +87,11 @@ xbps_pkg_exec_buffer(struct xbps_handle *xhp,
goto out; goto out;
} }
fchmod(fd, 0750); fchmod(fd, 0750);
#ifdef HAVE_FDATASYNC
fdatasync(fd); fdatasync(fd);
#else
fsync(fd);
#endif
close(fd); close(fd);
/* exec script */ /* exec script */