comparison src/memfile.c @ 15816:40336d427dd2 v8.1.0915

patch 8.1.0915: fsync() may not work properly on Mac commit https://github.com/vim/vim/commit/a787019518a540a7b4d0070f15467931b870ac89 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Feb 14 12:56:36 2019 +0100 patch 8.1.0915: fsync() may not work properly on Mac Problem: fsync() may not work properly on Mac. Solution: Use fcntl() with F_FULLFSYNC. (suggested by Justin M. Keyes)
author Bram Moolenaar <Bram@vim.org>
date Thu, 14 Feb 2019 13:00:22 +0100
parents 55ccc2d353bd
children 7fad90423bd2
comparison
equal deleted inserted replaced
15815:1095c7b7ff57 15816:40336d427dd2
598 /* 598 /*
599 * most Unixes have the very useful fsync() function, just what we need. 599 * most Unixes have the very useful fsync() function, just what we need.
600 */ 600 */
601 if (STRCMP(p_sws, "fsync") == 0) 601 if (STRCMP(p_sws, "fsync") == 0)
602 { 602 {
603 if (fsync(mfp->mf_fd)) 603 if (vim_fsync(mfp->mf_fd))
604 status = FAIL; 604 status = FAIL;
605 } 605 }
606 else 606 else
607 # endif 607 # endif
608 /* OpenNT is strictly POSIX (Benzinger) */ 608 /* OpenNT is strictly POSIX (Benzinger) */
615 # endif 615 # endif
616 #endif 616 #endif
617 #ifdef VMS 617 #ifdef VMS
618 if (STRCMP(p_sws, "fsync") == 0) 618 if (STRCMP(p_sws, "fsync") == 0)
619 { 619 {
620 if (fsync(mfp->mf_fd)) 620 if (vim_fsync(mfp->mf_fd))
621 status = FAIL; 621 status = FAIL;
622 } 622 }
623 #endif 623 #endif
624 #ifdef WIN32 624 #ifdef WIN32
625 if (_commit(mfp->mf_fd)) 625 if (_commit(mfp->mf_fd))
626 status = FAIL; 626 status = FAIL;
627 #endif 627 #endif
628 #ifdef AMIGA 628 #ifdef AMIGA
629 # if defined(__AROS__) || defined(__amigaos4__) 629 # if defined(__AROS__) || defined(__amigaos4__)
630 if (fsync(mfp->mf_fd) != 0) 630 if (vim_fsync(mfp->mf_fd) != 0)
631 status = FAIL; 631 status = FAIL;
632 # else 632 # else
633 /* 633 /*
634 * Flush() only exists for AmigaDos 2.0. 634 * Flush() only exists for AmigaDos 2.0.
635 * For 1.3 it should be done with close() + open(), but then the risk 635 * For 1.3 it should be done with close() + open(), but then the risk