Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions stable-patches/buffer.c.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git i/src/buffer.c w/src/buffer.c
index 748ffda..391bd32 100644
--- i/src/buffer.c
+++ w/src/buffer.c
diff --git a/src/buffer.c b/src/buffer.c
index 26e3ec969..0600b33a0 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -26,6 +26,9 @@
*/

Expand All @@ -12,7 +12,7 @@ index 748ffda..391bd32 100644


#ifdef FEAT_EVAL
@@ -2156,6 +2159,11 @@ buflist_new(
@@ -2175,6 +2178,11 @@ buflist_new(
{
char_u *ffname = ffname_arg;
char_u *sfname = sfname_arg;
Expand All @@ -24,7 +24,7 @@ index 748ffda..391bd32 100644
buf_T *buf;
#ifdef UNIX
stat_T st;
@@ -2164,6 +2172,70 @@ buflist_new(
@@ -2183,6 +2191,70 @@ buflist_new(
if (top_file_num == 1)
hash_init(&buf_hashtab);

Expand Down Expand Up @@ -62,16 +62,16 @@ index 748ffda..391bd32 100644
+ reclen = dsfile->reclen;
+ isdataset = TRUE;
+
+ // Create a temporary file to represent the dataset
+ ffname = vim_tempname('z', TRUE);
+
+ // Map dataset to file path
+ // Map dataset to a deterministic file path to enable swap file protection
+ char file_suffix[PATH_MAX];
+ char newpath[PATH_MAX];
+ char *user = getenv("USER");
Comment thread
sachintu47 marked this conversation as resolved.
+ if (user == NULL) user = "default";
+
+ map_to_unixfile(dsfile, file_suffix);
+ snprintf(newpath, PATH_MAX, "%s-%s", ffname, file_suffix);
+ snprintf(newpath, PATH_MAX, "/tmp/%s-%s", user, file_suffix);
Comment thread
sachintu47 marked this conversation as resolved.
+
+ // Set ffname and sfname to temporary
+ // Set ffname and sfname to the deterministic path
+ sfname = vim_strsave(newpath);
+ ffname = sfname;
+
Expand All @@ -95,7 +95,7 @@ index 748ffda..391bd32 100644
fname_expand(curbuf, &ffname, &sfname); // will allocate ffname

/*
@@ -2262,9 +2334,10 @@ buflist_new(
@@ -2281,9 +2353,10 @@ buflist_new(

if (ffname != NULL)
{
Expand All @@ -108,15 +108,15 @@ index 748ffda..391bd32 100644

clear_wininfo(buf);
buf->b_wininfo = ALLOC_CLEAR_ONE(wininfo_T);
@@ -2311,6 +2384,7 @@ buflist_new(
@@ -2330,6 +2403,7 @@ buflist_new(
}
lastbuf = buf;

+
if ((flags & BLN_REUSE) && buf_reuse.ga_len > 0)
{
// Recycle a previously used buffer number. Used for buffers which
@@ -2365,6 +2439,13 @@ buflist_new(
@@ -2384,6 +2458,13 @@ buflist_new(
#endif

buf->b_fname = buf->b_sfname;
Expand Down
Loading