diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-08-16 08:33:21 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-08-16 08:33:21 -0400 |
commit | 640bced2f8bf64098d52841947a3145554d41041 (patch) | |
tree | 1787f0df28059d27fe32885bc4b972384ff09c2e /src/nvim/os | |
parent | 19207762fd6dccd83b89c96bb1163b0d0440defb (diff) | |
parent | 8f4ada5a2a5c1bfe546cf7d67d3531551ff6026c (diff) | |
download | rneovim-640bced2f8bf64098d52841947a3145554d41041.tar.gz rneovim-640bced2f8bf64098d52841947a3145554d41041.tar.bz2 rneovim-640bced2f8bf64098d52841947a3145554d41041.zip |
Merge pull request #950 from Hinidu/os_fchown
Implement os_fchown 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. |