From: Bert Belder Date: Thu, 25 Nov 2010 00:25:25 +0000 (+0100) Subject: Fix fsync/fdatasync for windows X-Git-Tag: v0.3.4~74 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8fc3bac868dc7fcaa1a5760e4f3e1497c54ff577;p=platform%2Fupstream%2Fnodejs.git Fix fsync/fdatasync for windows --- diff --git a/src/node_file.cc b/src/node_file.cc index 241965c..f17cbfa 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -437,6 +437,8 @@ static Handle Fdatasync(const Arguments& args) { } else { #if HAVE_FDATASYNC int ret = fdatasync(fd); +#elif defined(__MINGW32__) + int ret = FlushFileBuffers((HANDLE)_get_osfhandle(fd)) ? 0 : -1; #else int ret = fsync(fd); #endif @@ -457,7 +459,11 @@ static Handle Fsync(const Arguments& args) { if (args[1]->IsFunction()) { ASYNC_CALL(fsync, args[1], fd) } else { +#ifdef __MINGW32__ + int ret = FlushFileBuffers((HANDLE)_get_osfhandle(fd)) ? 0 : -1; +#else int ret = fsync(fd); +#endif if (ret != 0) return ThrowException(ErrnoException(errno)); return Undefined(); }