aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/fs.c
diff options
context:
space:
mode:
authorckelsel <ckelsel@hotmail.com>2017-08-12 08:28:10 +0800
committerckelsel <ckelsel@hotmail.com>2017-08-12 08:28:10 +0800
commitd59e9a2c25c563e3460b1eeb31ab4d5971097331 (patch)
tree26f42a8d349db94f9faf87846aaae116582a76e7 /src/nvim/os/fs.c
parent9a5d309b5743d70832b4daedcea934af5e6cc127 (diff)
parentf2fd5afb48786c4272105b0adda6977ee1fd6f2e (diff)
downloadrneovim-d59e9a2c25c563e3460b1eeb31ab4d5971097331.tar.gz
rneovim-d59e9a2c25c563e3460b1eeb31ab4d5971097331.tar.bz2
rneovim-d59e9a2c25c563e3460b1eeb31ab4d5971097331.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/nvim/os/fs.c')
-rw-r--r--src/nvim/os/fs.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index 9e3025cf89..6ac9d682d7 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -605,8 +605,11 @@ int os_fsync(int fd)
///
/// @return libuv return code.
static int os_stat(const char *name, uv_stat_t *statbuf)
- FUNC_ATTR_NONNULL_ALL
+ FUNC_ATTR_NONNULL_ARG(2)
{
+ if (!name) {
+ return UV_ENOENT;
+ }
uv_fs_t request;
int result = uv_fs_stat(&fs_loop, &request, name, NULL);
*statbuf = request.statbuf;
@@ -618,7 +621,6 @@ static int os_stat(const char *name, uv_stat_t *statbuf)
///
/// @return libuv error code on error.
int32_t os_getperm(const char *name)
- FUNC_ATTR_NONNULL_ALL
{
uv_stat_t statbuf;
int stat_result = os_stat(name, &statbuf);
@@ -657,7 +659,6 @@ int os_fchown(int fd, uv_uid_t owner, uv_gid_t group)
///
/// @return `true` if `path` exists
bool os_path_exists(const char_u *path)
- FUNC_ATTR_NONNULL_ALL
{
uv_stat_t statbuf;
return os_stat((char *)path, &statbuf) == kLibuvSuccess;
@@ -847,7 +848,7 @@ int os_remove(const char *path)
/// @param[out] file_info Pointer to a FileInfo to put the information in.
/// @return `true` on success, `false` for failure.
bool os_fileinfo(const char *path, FileInfo *file_info)
- FUNC_ATTR_NONNULL_ALL
+ FUNC_ATTR_NONNULL_ARG(2)
{
return os_stat(path, &(file_info->stat)) == kLibuvSuccess;
}