]> granicus.if.org Git - vim/commitdiff
patch 8.1.0423: MS-Windows: using dup-close for flushing a file v8.1.0423
authorBram Moolenaar <Bram@vim.org>
Fri, 21 Sep 2018 12:48:53 +0000 (14:48 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 21 Sep 2018 12:48:53 +0000 (14:48 +0200)
Problem:    MS-Windows: using dup-close for flushing a file.
Solution:   Use _commit(). (Ken Takata, closes #3463)

src/memfile.c
src/os_mac.h
src/os_win32.h
src/version.c

index 0d07b7558633e6f189f7b313dfe9c47d2fd1521d..1e7390079cf024e92604740cfc42069a5aa6fa7d 100644 (file)
@@ -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__)
index f1c7cb719b4714e759ce48ae243398deab672561..c858a6224af6f52c86ea47dcf649586b4eb5e418 100644 (file)
 #define HAVE_AVAIL_MEM
 
 #ifndef HAVE_CONFIG_H
-/* #define SYNC_DUP_CLOSE         sync() a file with dup() and close() */
 # define HAVE_STRING_H
 # define HAVE_STRCSPN
 # define HAVE_MEMSET
index 4b1fc39bbfc04beb17aa7c0fabbe88b09c29653c..37f6106f7f62d31b27f6e02ad283e7234b0cabea 100644 (file)
@@ -26,7 +26,6 @@
 
 #define BINARY_FILE_IO
 #define USE_EXE_NAME           /* use argv[0] for $VIM */
-#define SYNC_DUP_CLOSE         /* sync() a file with dup() and close() */
 #define USE_TERM_CONSOLE
 #ifndef HAVE_STRING_H
 # define HAVE_STRING_H
index 372fe87f3feb7be5d93b7912e5e59e31810c1470..0ff6945e43d0c2a05a82b9aed4de59f5342c88f2 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    423,
 /**/
     422,
 /**/