summaryrefslogtreecommitdiffstats
path: root/src/memline.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-05-27 18:02:55 +0100
committerBram Moolenaar <Bram@vim.org>2023-05-27 18:02:55 +0100
commit3a2a60ce4a8e73594bca16814672fcc243d093ac (patch)
tree4a105c50b7f3a3e219e49bd73f5f4730d90bcefd /src/memline.c
parenta40c0bcc83c32da02869f59b10538d6327df61c5 (diff)
patch 9.0.1583: get E304 when using 'cryptmethod' "xchacha20v2"v9.0.1583
Problem: Get E304 when using 'cryptmethod' "xchacha20v2". (Steve Mynott) Solution: Add 4th crypt method to block zero ID check. Avoid syncing a swap file before reading the file. (closes #12433)
Diffstat (limited to 'src/memline.c')
-rw-r--r--src/memline.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/memline.c b/src/memline.c
index af354a5bff..40cb0109b7 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -64,7 +64,7 @@ typedef struct pointer_entry PTR_EN; // block/line-count pair
#define BLOCK0_ID1_C0 'c' // block 0 id 1 'cm' 0
#define BLOCK0_ID1_C1 'C' // block 0 id 1 'cm' 1
#define BLOCK0_ID1_C2 'd' // block 0 id 1 'cm' 2
-// BLOCK0_ID1_C3 and BLOCK0_ID1_C4 are for libsodium enctyption. However, for
+// BLOCK0_ID1_C3 and BLOCK0_ID1_C4 are for libsodium encryption. However, for
// these the swapfile is disabled, thus they will not be used. Added for
// consistency anyway.
#define BLOCK0_ID1_C3 'S' // block 0 id 1 'cm' 3
@@ -807,6 +807,8 @@ ml_open_file(buf_T *buf)
continue;
if (mf_open_file(mfp, fname) == OK) // consumes fname!
{
+ // don't sync yet in ml_sync_all()
+ mfp->mf_dirty = MF_DIRTY_YES_NOSYNC;
#if defined(MSWIN)
/*
* set full pathname for swap file now, because a ":!cd dir" may
@@ -939,7 +941,8 @@ ml_check_b0_id(ZERO_BL *b0p)
&& b0p->b0_id[1] != BLOCK0_ID1_C0
&& b0p->b0_id[1] != BLOCK0_ID1_C1
&& b0p->b0_id[1] != BLOCK0_ID1_C2
- && b0p->b0_id[1] != BLOCK0_ID1_C3)
+ && b0p->b0_id[1] != BLOCK0_ID1_C3
+ && b0p->b0_id[1] != BLOCK0_ID1_C4)
)
return FAIL;
return OK;
@@ -2513,7 +2516,7 @@ ml_sync_all(int check_file, int check_char)
need_check_timestamps = TRUE; // give message later
}
}
- if (buf->b_ml.ml_mfp->mf_dirty)
+ if (buf->b_ml.ml_mfp->mf_dirty == MF_DIRTY_YES)
{
(void)mf_sync(buf->b_ml.ml_mfp, (check_char ? MFS_STOP : 0)
| (bufIsChanged(buf) ? MFS_FLUSH : 0));