diff src/memfile.c @ 14822:aa9c7588d30a v8.1.0423

patch 8.1.0423: MS-Windows: using dup-close for flushing a file commit https://github.com/vim/vim/commit/0bd405173234b7d749aac144f60b68fee2135cb3 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 21 14:48:53 2018 +0200 patch 8.1.0423: MS-Windows: using dup-close for flushing a file Problem: MS-Windows: using dup-close for flushing a file. Solution: Use _commit(). (Ken Takata, closes https://github.com/vim/vim/issues/3463)
author Christian Brabandt <cb@256bit.org>
date Fri, 21 Sep 2018 15:00:06 +0200
parents ac42c4b11dbc
children 55ccc2d353bd
line wrap: on
line diff
--- a/src/memfile.c
+++ b/src/memfile.c
@@ -539,9 +539,6 @@ mf_sync(memfile_T *mfp, int flags)
 {
     int		status;
     bhdr_T	*hp;
-#if defined(SYNC_DUP_CLOSE)
-    int		fd;
-#endif
     int		got_int_save = got_int;
 
     if (mfp->mf_fd < 0)	    /* there is no file, nothing to do */
@@ -624,13 +621,9 @@ mf_sync(memfile_T *mfp, int flags)
 		status = FAIL;
 	}
 #endif
-#ifdef SYNC_DUP_CLOSE
-	/*
-	 * Win32 is a bit more work: Duplicate the file handle and close it.
-	 * This should flush the file to disk.
-	 */
-	if ((fd = dup(mfp->mf_fd)) >= 0)
-	    close(fd);
+#ifdef WIN32
+	if (_commit(mfp->mf_fd))
+	    status = FAIL;
 #endif
 #ifdef AMIGA
 # if defined(__AROS__) || defined(__amigaos4__)