diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-09-21 14:48:53 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-09-21 14:48:53 +0200 |
commit | 0bd405173234b7d749aac144f60b68fee2135cb3 (patch) | |
tree | fb3accf05d842c165661a1b043608d164970a52b | |
parent | 4ff4290de1a9c0fddc02b3fc84f5947bb09db06c (diff) |
patch 8.1.0423: MS-Windows: using dup-close for flushing a filev8.1.0423
Problem: MS-Windows: using dup-close for flushing a file.
Solution: Use _commit(). (Ken Takata, closes #3463)
-rw-r--r-- | src/memfile.c | 13 | ||||
-rw-r--r-- | src/os_mac.h | 1 | ||||
-rw-r--r-- | src/os_win32.h | 1 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 5 insertions, 12 deletions
diff --git a/src/memfile.c b/src/memfile.c index 0d07b75586..1e7390079c 100644 --- 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__) diff --git a/src/os_mac.h b/src/os_mac.h index f1c7cb719b..c858a6224a 100644 --- a/src/os_mac.h +++ b/src/os_mac.h @@ -101,7 +101,6 @@ #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 diff --git a/src/os_win32.h b/src/os_win32.h index 4b1fc39bbf..37f6106f7f 100644 --- a/src/os_win32.h +++ b/src/os_win32.h @@ -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 diff --git a/src/version.c b/src/version.c index 372fe87f3f..0ff6945e43 100644 --- a/src/version.c +++ b/src/version.c @@ -795,6 +795,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 423, +/**/ 422, /**/ 421, |