Skip to content

Commit 4356836

Browse files
cjihrigtargos
authored andcommitted
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 <[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]>
1 parent acdc21b commit 4356836

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/fs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ function writev(fd, buffers, position, callback) {
609609
callback(err, written || 0, buffers);
610610
}
611611

612-
validateUint32(fd, 'fd');
612+
validateInt32(fd, 'fd', 0);
613613

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

637-
validateUint32(fd, 'fd');
637+
validateInt32(fd, 'fd', 0);
638638
const ctx = {};
639639

640640
if (!isBuffersArray(buffers)) {

0 commit comments

Comments
 (0)