Skip to content

Commit

Permalink
fs: validate writev fds consistently
Browse files Browse the repository at this point in the history
This commit updates the recently added writev methods
to validate file descriptors like the other fs methods do.

PR-URL: #29185
Refs: #25925
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Anto Aravinth <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
cjihrig authored and targos committed Aug 20, 2019
1 parent acdc21b commit 4356836
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ function writev(fd, buffers, position, callback) {
callback(err, written || 0, buffers);
}

validateUint32(fd, 'fd');
validateInt32(fd, 'fd', 0);

if (!isBuffersArray(buffers)) {
throw new ERR_INVALID_ARG_TYPE('buffers', 'ArrayBufferView[]', buffers);
Expand All @@ -634,7 +634,7 @@ Object.defineProperty(writev, internalUtil.customPromisifyArgs, {
// fs.writevSync(fd, buffers[, position]);
function writevSync(fd, buffers, position) {

validateUint32(fd, 'fd');
validateInt32(fd, 'fd', 0);
const ctx = {};

if (!isBuffersArray(buffers)) {
Expand Down

0 comments on commit 4356836

Please sign in to comment.