aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/fileio.c2
-rw-r--r--src/nvim/globals.h1
-rw-r--r--src/nvim/testdir/test_writefile.vim7
3 files changed, 9 insertions, 1 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index e2b77d9605..f2a664288b 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -3363,7 +3363,7 @@ restore_backup:
if (p_fs && (error = os_fsync(fd)) != 0 && !device
// fsync not supported on this storage.
&& error != UV_ENOTSUP) {
- SET_ERRMSG_ARG(_("E667: Fsync failed: %s"), error);
+ SET_ERRMSG_ARG(e_fsync, error);
end = 0;
}
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 78409267a4..40184a4bb9 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -958,6 +958,7 @@ EXTERN char_u e_streamkey[] INIT(= N_(
"E5210: dict key '%s' already set for buffered stream in channel %"
PRIu64));
EXTERN char_u e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\""));
+EXTERN char e_fsync[] INIT(= N_("E667: Fsync failed: %s"));
EXTERN char_u e_mkdir[] INIT(= N_("E739: Cannot create directory %s: %s"));
EXTERN char_u e_markinval[] INIT(= N_("E19: Mark has invalid line number"));
EXTERN char_u e_marknotset[] INIT(= N_("E20: Mark not set"));
diff --git a/src/nvim/testdir/test_writefile.vim b/src/nvim/testdir/test_writefile.vim
index 9c9e051bc9..9da9df2150 100644
--- a/src/nvim/testdir/test_writefile.vim
+++ b/src/nvim/testdir/test_writefile.vim
@@ -167,3 +167,10 @@ func Test_writefile_sync_dev_stdout()
throw 'Skipped: /dev/stdout is not writable'
endif
endfunc
+
+func Test_writefile_sync_arg()
+ " This doesn't check if fsync() works, only that the argument is accepted.
+ call writefile(['one'], 'Xtest', 's')
+ call writefile(['two'], 'Xtest', 'S')
+ call delete('Xtest')
+endfunc