diff options
author | Rui Abreu Ferreira <raf-ep@gmx.com> | 2015-10-27 10:44:15 +0000 |
---|---|---|
committer | Rui Abreu Ferreira <raf-ep@gmx.com> | 2015-11-25 23:15:37 +0000 |
commit | 091b6e216c74678e244edb8c3499d86f43d02df4 (patch) | |
tree | 255f8c192af77e00c6d5ed734d2cbc09f2e9706a /src | |
parent | 8dea8a036fcf4f8d0ce8fd26cc3826067b384f13 (diff) | |
download | rneovim-091b6e216c74678e244edb8c3499d86f43d02df4.tar.gz rneovim-091b6e216c74678e244edb8c3499d86f43d02df4.tar.bz2 rneovim-091b6e216c74678e244edb8c3499d86f43d02df4.zip |
Return libuv return code from os_stat()
Instead of returning bool from os_stat return the actual libuv return code.
This function is static and used internally in nvim/os/fs.c it should not
impact the rest of the API. This is a first step to change other fs functions.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/os/fs.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index 94b0be90fd..e13691652a 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -204,15 +204,15 @@ int os_open(const char* path, int flags, int mode) /// Get stat information for a file. /// -/// @return OK on success, FAIL if a failure occurred. -static bool os_stat(const char *name, uv_stat_t *statbuf) +/// @return libuv return code. +static int os_stat(const char *name, uv_stat_t *statbuf) FUNC_ATTR_NONNULL_ALL { uv_fs_t request; int result = uv_fs_stat(&fs_loop, &request, name, NULL); *statbuf = request.statbuf; uv_fs_req_cleanup(&request); - return (result == kLibuvSuccess); + return result; } /// Get the file permissions for a given file. @@ -222,7 +222,7 @@ int32_t os_getperm(const char_u *name) FUNC_ATTR_NONNULL_ALL { uv_stat_t statbuf; - if (os_stat((char *)name, &statbuf)) { + if (os_stat((char *)name, &statbuf) == kLibuvSuccess) { return (int32_t)statbuf.st_mode; } else { return -1; @@ -270,7 +270,7 @@ bool os_file_exists(const char_u *name) FUNC_ATTR_NONNULL_ALL { uv_stat_t statbuf; - return os_stat((char *)name, &statbuf); + return os_stat((char *)name, &statbuf) == kLibuvSuccess; } /// Check if a file is readable. @@ -470,7 +470,7 @@ int os_remove(const char *path) bool os_fileinfo(const char *path, FileInfo *file_info) FUNC_ATTR_NONNULL_ALL { - return os_stat(path, &(file_info->stat)); + return os_stat(path, &(file_info->stat)) == kLibuvSuccess; } /// Get the file information for a given path without following links @@ -572,7 +572,7 @@ bool os_fileid(const char *path, FileID *file_id) FUNC_ATTR_NONNULL_ALL { uv_stat_t statbuf; - if (os_stat(path, &statbuf)) { + if (os_stat(path, &statbuf) == kLibuvSuccess) { file_id->inode = statbuf.st_ino; file_id->device_id = statbuf.st_dev; return true; |