diff options
author | Will Spurgin <will.spurgin@gmail.com> | 2022-11-04 20:24:34 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-05 09:24:34 +0800 |
commit | 19a487bc86482392eb50c61375d20e440e6e16b7 (patch) | |
tree | 7ca39ed9bc728dc1e6e3c8ed6c83679e220e1da8 /src | |
parent | 95f2f3cb5efcc18f17f2812ba6d1d9e1c06b2b5a (diff) | |
download | rneovim-19a487bc86482392eb50c61375d20e440e6e16b7.tar.gz rneovim-19a487bc86482392eb50c61375d20e440e6e16b7.tar.bz2 rneovim-19a487bc86482392eb50c61375d20e440e6e16b7.zip |
fix(fileio): use first available directory in backupdir for backupcopy (#20655)
Fix backups failing for symlink files
Set backup to NULL prior to continuing & Clear backup prior to NULL set
to avoid leaking
Fixes #11349
Remove testing hacks in scripts for windows
Skip FreeBSD
Something appears up with these types of tests for FreeBSD on
Circus, see 2d6735d8ce
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/fileio.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index c3feadeb36..c780f64a7a 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -2781,10 +2781,11 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en #endif // copy the file - if (os_copy(fname, backup, UV_FS_COPYFILE_FICLONE) - != 0) { - SET_ERRMSG(_("E506: Can't write to backup file " - "(add ! to override)")); + if (os_copy(fname, backup, UV_FS_COPYFILE_FICLONE) != 0) { + SET_ERRMSG(_("E509: Cannot create backup file (add ! to override)")); + XFREE_CLEAR(backup); + backup = NULL; + continue; } #ifdef UNIX @@ -2795,6 +2796,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en #ifdef HAVE_ACL mch_set_acl((char_u *)backup, acl); #endif + SET_ERRMSG(NULL); break; } } |