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 #3463)
This commit is contained in:
Bram Moolenaar
2018-09-21 14:48:53 +02:00
parent 4ff4290de1
commit 0bd4051732
4 changed files with 5 additions and 12 deletions

View File

@ -539,9 +539,6 @@ mf_sync(memfile_T *mfp, int flags)
{ {
int status; int status;
bhdr_T *hp; bhdr_T *hp;
#if defined(SYNC_DUP_CLOSE)
int fd;
#endif
int got_int_save = got_int; int got_int_save = got_int;
if (mfp->mf_fd < 0) /* there is no file, nothing to do */ 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; status = FAIL;
} }
#endif #endif
#ifdef SYNC_DUP_CLOSE #ifdef WIN32
/* if (_commit(mfp->mf_fd))
* Win32 is a bit more work: Duplicate the file handle and close it. status = FAIL;
* This should flush the file to disk.
*/
if ((fd = dup(mfp->mf_fd)) >= 0)
close(fd);
#endif #endif
#ifdef AMIGA #ifdef AMIGA
# if defined(__AROS__) || defined(__amigaos4__) # if defined(__AROS__) || defined(__amigaos4__)

View File

@ -101,7 +101,6 @@
#define HAVE_AVAIL_MEM #define HAVE_AVAIL_MEM
#ifndef HAVE_CONFIG_H #ifndef HAVE_CONFIG_H
/* #define SYNC_DUP_CLOSE sync() a file with dup() and close() */
# define HAVE_STRING_H # define HAVE_STRING_H
# define HAVE_STRCSPN # define HAVE_STRCSPN
# define HAVE_MEMSET # define HAVE_MEMSET

View File

@ -26,7 +26,6 @@
#define BINARY_FILE_IO #define BINARY_FILE_IO
#define USE_EXE_NAME /* use argv[0] for $VIM */ #define USE_EXE_NAME /* use argv[0] for $VIM */
#define SYNC_DUP_CLOSE /* sync() a file with dup() and close() */
#define USE_TERM_CONSOLE #define USE_TERM_CONSOLE
#ifndef HAVE_STRING_H #ifndef HAVE_STRING_H
# define HAVE_STRING_H # define HAVE_STRING_H

View File

@ -794,6 +794,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
423,
/**/ /**/
422, 422,
/**/ /**/