Skip to content
Permalink
Browse files

fs: validate writev fds consistently

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 <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information...
cjihrig authored and targos committed Aug 17, 2019
1 parent acdc21b commit 435683610b8559755f424c7714336b364d95c1b5
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/fs.js
@@ -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);
@@ -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)) {

0 comments on commit 4356836

Please sign in to comment.
You can’t perform that action at this time.