patch 9.0.1583: get E304 when using 'cryptmethod' "xchacha20v2"
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)
diff --git a/src/memfile.c b/src/memfile.c
index 2689031..3104259 100644
--- a/src/memfile.c
+++ b/src/memfile.c
@@ -150,7 +150,7 @@
mfp->mf_free_first = NULL; // free list is empty
mfp->mf_used_first = NULL; // used list is empty
mfp->mf_used_last = NULL;
- mfp->mf_dirty = FALSE;
+ mfp->mf_dirty = MF_DIRTY_NO;
mfp->mf_used_count = 0;
mf_hash_init(&mfp->mf_hash);
mf_hash_init(&mfp->mf_trans);
@@ -224,7 +224,7 @@
if (mfp->mf_fd < 0)
return FAIL;
- mfp->mf_dirty = TRUE;
+ mfp->mf_dirty = MF_DIRTY_YES;
return OK;
}
@@ -386,7 +386,7 @@
}
}
hp->bh_flags = BH_LOCKED | BH_DIRTY; // new block is always dirty
- mfp->mf_dirty = TRUE;
+ mfp->mf_dirty = MF_DIRTY_YES;
hp->bh_page_count = page_count;
mf_ins_used(mfp, hp);
mf_ins_hash(mfp, hp);
@@ -483,7 +483,8 @@
if (dirty)
{
flags |= BH_DIRTY;
- mfp->mf_dirty = TRUE;
+ if (mfp->mf_dirty != MF_DIRTY_YES_NOSYNC)
+ mfp->mf_dirty = MF_DIRTY_YES;
}
hp->bh_flags = flags;
if (infile)
@@ -528,9 +529,10 @@
bhdr_T *hp;
int got_int_save = got_int;
- if (mfp->mf_fd < 0) // there is no file, nothing to do
+ if (mfp->mf_fd < 0)
{
- mfp->mf_dirty = FALSE;
+ // there is no file, nothing to do
+ mfp->mf_dirty = MF_DIRTY_NO;
return FAIL;
}
@@ -576,7 +578,7 @@
* In case of an error this flag is also set, to avoid trying all the time.
*/
if (hp == NULL || status == FAIL)
- mfp->mf_dirty = FALSE;
+ mfp->mf_dirty = MF_DIRTY_NO;
if ((flags & MFS_FLUSH) && *p_sws != NUL)
{
@@ -675,7 +677,7 @@
for (hp = mfp->mf_used_last; hp != NULL; hp = hp->bh_prev)
if (hp->bh_bnum > 0)
hp->bh_flags |= BH_DIRTY;
- mfp->mf_dirty = TRUE;
+ mfp->mf_dirty = MF_DIRTY_YES;
}
/*