summaryrefslogtreecommitdiff
path: root/lib/internal/fs/promises.js
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2018-06-23 16:26:29 -0400
committercjihrig <cjihrig@gmail.com>2018-06-27 11:37:17 -0400
commit7ff50f9e9cf5459c60f10f3919e79223c8b7446c (patch)
treed6b8221698f8582406f54385bdcd583c21c0ec26 /lib/internal/fs/promises.js
parent4750ce26f2e6079b5fee92bdee5356c279171d22 (diff)
downloadandroid-node-v8-7ff50f9e9cf5459c60f10f3919e79223c8b7446c.tar.gz
android-node-v8-7ff50f9e9cf5459c60f10f3919e79223c8b7446c.tar.bz2
android-node-v8-7ff50f9e9cf5459c60f10f3919e79223c8b7446c.zip
fs: undeprecate lchown()
uv_fs_lchown() exists, as of libuv 1.21.0. fs.lchown() can now be undeprecated. This commit also adds tests, as there were none. PR-URL: https://github.com/nodejs/node/pull/21498 Fixes: https://github.com/nodejs/node/issues/19868 Reviewed-By: Wyatt Preul <wpreul@gmail.com>
Diffstat (limited to 'lib/internal/fs/promises.js')
-rw-r--r--lib/internal/fs/promises.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js
index 750d0d7579..0cac39534a 100644
--- a/lib/internal/fs/promises.js
+++ b/lib/internal/fs/promises.js
@@ -377,11 +377,12 @@ async function lchmod(path, mode) {
}
async function lchown(path, uid, gid) {
- if (O_SYMLINK === undefined)
- throw new ERR_METHOD_NOT_IMPLEMENTED();
-
- const fd = await open(path, O_WRONLY | O_SYMLINK);
- return fchown(fd, uid, gid).finally(fd.close.bind(fd));
+ path = getPathFromURL(path);
+ validatePath(path);
+ validateUint32(uid, 'uid');
+ validateUint32(gid, 'gid');
+ return binding.lchown(pathModule.toNamespacedPath(path),
+ uid, gid, kUsePromises);
}
async function fchown(handle, uid, gid) {