diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-05-26 18:51:19 +0800 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-06-01 11:12:10 +0200 |
commit | cf723015458031fc80398971a0cfa0cbc9440004 (patch) | |
tree | a9d3bb16ae69d719180b76193db84215de6fefdb /lib/internal/fs/promises.js | |
parent | 38c938aa90a4346f0fc4e2ec77ebf180386f9ee5 (diff) | |
download | android-node-v8-cf723015458031fc80398971a0cfa0cbc9440004.tar.gz android-node-v8-cf723015458031fc80398971a0cfa0cbc9440004.tar.bz2 android-node-v8-cf723015458031fc80398971a0cfa0cbc9440004.zip |
lib: unmask mode_t values with 0o777
This commit allows permission bits higher than 0o777 to go through
the API (e.g. `S_ISVTX`=`0o1000`, `S_ISGID`=`0o2000`,
`S_ISUID`=`0o4000`).
Also documents that these bits are not exposed through `fs.constants`
and their behaviors are platform-specific, so the users need to
use them on their own risk.
PR-URL: https://github.com/nodejs/node/pull/20975
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/internal/fs/promises.js')
-rw-r--r-- | lib/internal/fs/promises.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js index 8774f48e99..43956dae3f 100644 --- a/lib/internal/fs/promises.js +++ b/lib/internal/fs/promises.js @@ -32,7 +32,7 @@ const { } = require('internal/fs/utils'); const { isUint32, - validateAndMaskMode, + validateMode, validateInteger, validateUint32 } = require('internal/validators'); @@ -192,7 +192,7 @@ async function copyFile(src, dest, flags) { async function open(path, flags, mode) { path = getPathFromURL(path); validatePath(path); - mode = validateAndMaskMode(mode, 'mode', 0o666); + mode = validateMode(mode, 'mode', 0o666); return new FileHandle( await binding.openFileHandle(pathModule.toNamespacedPath(path), stringToFlags(flags), @@ -287,7 +287,7 @@ async function fsync(handle) { async function mkdir(path, mode) { path = getPathFromURL(path); validatePath(path); - mode = validateAndMaskMode(mode, 'mode', 0o777); + mode = validateMode(mode, 'mode', 0o777); return binding.mkdir(pathModule.toNamespacedPath(path), mode, kUsePromises); } @@ -359,14 +359,14 @@ async function unlink(path) { async function fchmod(handle, mode) { validateFileHandle(handle); - mode = validateAndMaskMode(mode, 'mode'); + mode = validateMode(mode, 'mode'); return binding.fchmod(handle.fd, mode, kUsePromises); } async function chmod(path, mode) { path = getPathFromURL(path); validatePath(path); - mode = validateAndMaskMode(mode, 'mode'); + mode = validateMode(mode, 'mode'); return binding.chmod(pathModule.toNamespacedPath(path), mode, kUsePromises); } |