mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 20:46:16 +00:00

This patch 1. moves the basic validation of arguments to `truncate` family of functions to the JavaScript layer from the C++ layer. 2. makes sure that the File Descriptors are validated strictly. PR-URL: https://github.com/nodejs/node/pull/2498 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
14 lines
390 B
JavaScript
14 lines
390 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
const fs = require('fs');
|
|
const assert = require('assert');
|
|
|
|
assert.throws(function() {
|
|
fs.write(null, Buffer.allocUnsafe(1), 0, 1, () => {});
|
|
}, /TypeError: file descriptor must be a unsigned 32-bit integer/);
|
|
|
|
assert.throws(function() {
|
|
fs.write(undefined, '1', 0, 1, () => {});
|
|
}, /TypeError: file descriptor must be a unsigned 32-bit integer/);
|