From 7833df14ba7cbc2acab87d43e226a4d874aad698 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sat, 6 Oct 2012 17:19:09 +0200 Subject: [PATCH] freebsd, openbsd: don't use fdatasync() The fdatasync() system call does not exist on either FreeBSD or OpenBSD, fall back to fsync(). --- src/unix/fs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/unix/fs.c b/src/unix/fs.c index 8d26cd8fe..c8a2d632c 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -98,10 +98,12 @@ static ssize_t uv__fs_fdatasync(uv_fs_t* req) { -#if defined(__APPLE__) && defined(F_FULLFSYNC) +#if defined(__linux__) || defined(__sun) || defined(__NetBSD__) + return fdatasync(req->file); +#elif defined(__APPLE__) && defined(F_FULLFSYNC) return fcntl(req->file, F_FULLFSYNC); #else - return fdatasync(req->file); + return fsync(req->file); #endif }