summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-chmod.js
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2018-05-09 22:44:44 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2018-05-17 17:14:35 +0800
commita18e130e597c3efc1df7bd86198c2b5762d4fbae (patch)
tree584b4e8b5c5a67a3272f2e66646de497777e4dc4 /test/parallel/test-fs-chmod.js
parent0d9500daedbb61770359c34383a8d4784bcabd56 (diff)
downloadandroid-node-v8-a18e130e597c3efc1df7bd86198c2b5762d4fbae.tar.gz
android-node-v8-a18e130e597c3efc1df7bd86198c2b5762d4fbae.tar.bz2
android-node-v8-a18e130e597c3efc1df7bd86198c2b5762d4fbae.zip
lib: mask mode_t type of arguments with 0o777
- Introduce the `validateAndMaskMode` validator that validates `mode_t` arguments and mask them with 0o777 if they are 32-bit unsigned integer or octal string to be more consistent with POSIX APIs. - Use the validator in fs APIs and process.umask for consistency. - Add tests for 32-bit unsigned modes larger than 0o777. PR-URL: https://github.com/nodejs/node/pull/20636 Fixes: https://github.com/nodejs/node/issues/20498 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Diffstat (limited to 'test/parallel/test-fs-chmod.js')
-rw-r--r--test/parallel/test-fs-chmod.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/parallel/test-fs-chmod.js b/test/parallel/test-fs-chmod.js
index 6727ec2144..ed5919ce88 100644
--- a/test/parallel/test-fs-chmod.js
+++ b/test/parallel/test-fs-chmod.js
@@ -62,7 +62,7 @@ function closeSync() {
}
-// On Windows chmod is only able to manipulate read-only bit
+// On Windows chmod is only able to manipulate write permission
if (common.isWindows) {
mode_async = 0o400; // read-only
mode_sync = 0o600; // read-write
@@ -112,10 +112,10 @@ fs.open(file2, 'w', common.mustCall((err, fd) => {
common.expectsError(
() => fs.fchmod(fd, {}),
{
- code: 'ERR_INVALID_ARG_TYPE',
+ code: 'ERR_INVALID_ARG_VALUE',
type: TypeError,
- message: 'The "mode" argument must be of type number. ' +
- 'Received type object'
+ message: 'The argument \'mode\' must be a 32-bit unsigned integer ' +
+ 'or an octal string. Received {}'
}
);