Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
quic: fixup test-fs-chown
PR-URL: nodejs/quic#360
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
jasnell committed Mar 13, 2020
commit e7b25da6a8ce654699896c14026e53b8717b6470
24 changes: 12 additions & 12 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1154,26 +1154,26 @@ function chmodSync(path, mode) {
function lchown(path, uid, gid, callback) {
callback = makeCallback(callback);
path = getValidatedPath(path);
validateInteger(uid, 'uid', -1, kMaxUserId);
validateInteger(gid, 'gid', -1, kMaxUserId);
validateInteger(uid, 'uid', { min: -1, max: kMaxUserId });
validateInteger(gid, 'gid', { min: -1, max: kMaxUserId });
const req = new FSReqCallback();
req.oncomplete = callback;
binding.lchown(pathModule.toNamespacedPath(path), uid, gid, req);
}

function lchownSync(path, uid, gid) {
path = getValidatedPath(path);
validateInteger(uid, 'uid', -1, kMaxUserId);
validateInteger(gid, 'gid', -1, kMaxUserId);
validateInteger(uid, 'uid', { min: -1, max: kMaxUserId });
validateInteger(gid, 'gid', { min: -1, max: kMaxUserId });
const ctx = { path };
binding.lchown(pathModule.toNamespacedPath(path), uid, gid, undefined, ctx);
handleErrorFromBinding(ctx);
}

function fchown(fd, uid, gid, callback) {
validateInt32(fd, 'fd', 0);
validateInteger(uid, 'uid', -1, kMaxUserId);
validateInteger(gid, 'gid', -1, kMaxUserId);
validateInteger(uid, 'uid', { min: -1, max: kMaxUserId });
validateInteger(gid, 'gid', { min: -1, max: kMaxUserId });

const req = new FSReqCallback();
req.oncomplete = makeCallback(callback);
Expand All @@ -1182,8 +1182,8 @@ function fchown(fd, uid, gid, callback) {

function fchownSync(fd, uid, gid) {
validateInt32(fd, 'fd', 0);
validateInteger(uid, 'uid', -1, kMaxUserId);
validateInteger(gid, 'gid', -1, kMaxUserId);
validateInteger(uid, 'uid', { min: -1, max: kMaxUserId });
validateInteger(gid, 'gid', { min: -1, max: kMaxUserId });

const ctx = {};
binding.fchown(fd, uid, gid, undefined, ctx);
Expand All @@ -1193,8 +1193,8 @@ function fchownSync(fd, uid, gid) {
function chown(path, uid, gid, callback) {
callback = makeCallback(callback);
path = getValidatedPath(path);
validateInteger(uid, 'uid', -1, kMaxUserId);
validateInteger(gid, 'gid', -1, kMaxUserId);
validateInteger(uid, 'uid', { min: -1, max: kMaxUserId });
validateInteger(gid, 'gid', { min: -1, max: kMaxUserId });

const req = new FSReqCallback();
req.oncomplete = callback;
Expand All @@ -1203,8 +1203,8 @@ function chown(path, uid, gid, callback) {

function chownSync(path, uid, gid) {
path = getValidatedPath(path);
validateInteger(uid, 'uid', -1, kMaxUserId);
validateInteger(gid, 'gid', -1, kMaxUserId);
validateInteger(uid, 'uid', { min: -1, max: kMaxUserId });
validateInteger(gid, 'gid', { min: -1, max: kMaxUserId });
const ctx = { path };
binding.chown(pathModule.toNamespacedPath(path), uid, gid, undefined, ctx);
handleErrorFromBinding(ctx);
Expand Down