aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fileio.c
diff options
context:
space:
mode:
authorRui Abreu Ferreira <raf-ep@gmx.com>2015-10-27 11:37:50 +0000
committerRui Abreu Ferreira <raf-ep@gmx.com>2015-11-25 23:15:38 +0000
commitd54338f1e0fe971aad34d9bb6ed17805c38802a3 (patch)
tree89cda2be3716a4ae16cd8096d798df39aae0ae99 /src/nvim/fileio.c
parent091b6e216c74678e244edb8c3499d86f43d02df4 (diff)
downloadrneovim-d54338f1e0fe971aad34d9bb6ed17805c38802a3.tar.gz
rneovim-d54338f1e0fe971aad34d9bb6ed17805c38802a3.tar.bz2
rneovim-d54338f1e0fe971aad34d9bb6ed17805c38802a3.zip
Return libuv error code from os_getperm()
Previously os_getperms() returned -1 for any error condition, it now returns the libuv error code (as returned by os_stat()). This allows checking for error conditions without relying on errno (which not available in Windows). The only case where the errno value from os_getperms() was being used was in readfile() to set the new-file flag - replaced the errno check with UV_ENOENT.
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r--src/nvim/fileio.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index c07597df47..1bee50b717 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -535,11 +535,7 @@ readfile (
if (!newfile) {
return FAIL;
}
- if (perm < 0
-#ifdef ENOENT
- && errno == ENOENT
-#endif
- ) {
+ if (perm == UV_ENOENT) {
/*
* Set the 'new-file' flag, so that when the file has
* been created by someone else, a ":w" will complain.