aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-08-07 19:24:50 -0400
committerJustin M. Keyes <justinkz@gmail.com>2016-08-07 20:39:37 -0400
commit8625c1d1040037167d47da9dc6a8e79b348df681 (patch)
treec6ca95459be0c00def712344fd824662d23e104d /src
parent8d09301090156712ae1a99888866831cf1dc3bcf (diff)
downloadrneovim-8625c1d1040037167d47da9dc6a8e79b348df681.tar.gz
rneovim-8625c1d1040037167d47da9dc6a8e79b348df681.tar.bz2
rneovim-8625c1d1040037167d47da9dc6a8e79b348df681.zip
win32: readfile(): Directories should not show "[Permission Denied]".
77135447e09903b45d1482da45869946212f7904 introduced: if (!newfile) { return FAIL; } which changed the semantics of the un-braced `else` in the `#ifndef UNIX` block immediately above it. This commit restores the semantics of Vim. Until now it mostly worked by accident, but on Windows it would mean that opening a directory would show "[Permission Denied]".
Diffstat (limited to 'src')
-rw-r--r--src/nvim/fileio.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index a4f069be04..e0b6ae1215 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -505,17 +505,15 @@ readfile (
// On non-unix systems we can't open a directory, check here.
if (os_isdir(fname)) {
filemess(curbuf, sfname, (char_u *)_("is a directory"), 0);
- curbuf->b_p_ro = TRUE; /* must use "w!" now */
- } else
+ curbuf->b_p_ro = true; // must use "w!" now
+ } else {
#endif
if (!newfile) {
return FAIL;
}
if (perm == UV_ENOENT) { // check if the file exists
- /*
- * Set the 'new-file' flag, so that when the file has
- * been created by someone else, a ":w" will complain.
- */
+ // Set the 'new-file' flag, so that when the file has
+ // been created by someone else, a ":w" will complain.
curbuf->b_flags |= BF_NEW;
/* Create a swap file now, so that other Vims are warned
@@ -566,6 +564,9 @@ readfile (
return FAIL;
}
+#ifndef UNIX
+ }
+#endif
/*
* Only set the 'ro' flag for readonly files the first time they are