mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
Fix fsync/fdatasync for windows
This commit is contained in:
1 parent
fae7b81589
commit
8fc3bac868
1 file changed
+6
@@ -437,6 +437,8 @@ static Handle<Value> 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<Value> 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();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user