diff options
author | Pavel Platto <hinidu@gmail.com> | 2014-07-14 00:04:59 +0300 |
---|---|---|
committer | Pavel Platto <hinidu@gmail.com> | 2014-08-13 09:13:58 +0300 |
commit | 94f3d30306ebe3856dc98b6afc4d29728ec3f3af (patch) | |
tree | 40ab2d5af4018ee79dc6808b9736fd9eb0d4bb89 /src/nvim/os | |
parent | 563f38c317908a94893727db501e325f29710edb (diff) | |
download | rneovim-94f3d30306ebe3856dc98b6afc4d29728ec3f3af.tar.gz rneovim-94f3d30306ebe3856dc98b6afc4d29728ec3f3af.tar.bz2 rneovim-94f3d30306ebe3856dc98b6afc4d29728ec3f3af.zip |
os_fchown: impl and remove HAVE_FCHOWN
Diffstat (limited to 'src/nvim/os')
-rw-r--r-- | src/nvim/os/fs.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index 4820a4d165..aca7005064 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -210,6 +210,21 @@ int os_setperm(const char_u *name, int perm) return FAIL; } +/// Changes the ownership of the file referred to by the open file descriptor. +/// +/// @return `0` on success, a libuv error code on failure. +/// +/// @note If the `owner` or `group` is specified as `-1`, then that ID is not +/// changed. +int os_fchown(int file_descriptor, uv_uid_t owner, uv_gid_t group) +{ + uv_fs_t request; + int result = uv_fs_fchown(uv_default_loop(), &request, file_descriptor, + owner, group, NULL); + uv_fs_req_cleanup(&request); + return result; +} + /// Check if a file exists. /// /// @return `true` if `name` exists. |