aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-04-01 22:38:21 +0200
committerGitHub <noreply@github.com>2017-04-01 22:38:20 +0200
commit518f28f537971c70d7781ce30c5de0c829e01464 (patch)
tree9c76363156ee48433f1f213437320b7bcf45704e /src/nvim/eval.c
parent337b6179df852350b52409fd3806e4b47ab2875b (diff)
parent19690d4a25f15dfa752ac3723384f1d33f06329a (diff)
downloadrneovim-518f28f537971c70d7781ce30c5de0c829e01464.tar.gz
rneovim-518f28f537971c70d7781ce30c5de0c829e01464.tar.bz2
rneovim-518f28f537971c70d7781ce30c5de0c829e01464.zip
Merge #6422 from ZyX-I/fix-6420
eval,fileio: Omit additional fsync() call
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 15b712e7de..f0d78a2508 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -17289,7 +17289,7 @@ static bool write_list(FileDescriptor *const fp, const list_T *const list,
}
}
}
- if ((error = file_fsync(fp)) != 0) {
+ if ((error = file_flush(fp)) != 0) {
goto write_list_error;
}
return true;
@@ -17439,21 +17439,21 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (fname == NULL) {
return;
}
- FileDescriptor *fp;
+ FileDescriptor fp;
int error;
rettv->vval.v_number = -1;
if (*fname == NUL) {
EMSG(_("E482: Can't open file with an empty name"));
- } else if ((fp = file_open_new(&error, fname,
- ((append ? kFileAppend : kFileTruncate)
- | kFileCreate), 0666)) == NULL) {
+ } else if ((error = file_open(&fp, fname,
+ ((append ? kFileAppend : kFileTruncate)
+ | kFileCreate), 0666)) != 0) {
emsgf(_("E482: Can't open file %s for writing: %s"),
fname, os_strerror(error));
} else {
- if (write_list(fp, argvars[0].vval.v_list, binary)) {
+ if (write_list(&fp, argvars[0].vval.v_list, binary)) {
rettv->vval.v_number = 0;
}
- if ((error = file_free(fp)) != 0) {
+ if ((error = file_close(&fp)) != 0) {
emsgf(_("E80: Error when closing file %s: %s"),
fname, os_strerror(error));
}