Skip to content

Commit

Permalink
net: use strict comparisons for fd
Browse files Browse the repository at this point in the history
This commit removes an eslint-disable comment, and moves file
descriptor checks to use strict equality. These checks were
using loose equality to support numeric and string file
descriptors. However, d9e95d8
introduced strict validation, making the loose equality checks
redundant.

PR-URL: #25014
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
cjihrig authored and BethGriggs committed Dec 18, 2018
1 parent 4f0d17b commit f4d5c35
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,8 @@ function Socket(options) {
throw errnoException(err, 'open');

this[async_id_symbol] = this._handle.getAsyncId();
// options.fd can be string (since it is user-defined),
// so changing this to === would be semver-major
// See: https://github.com/nodejs/node/pull/11513
// eslint-disable-next-line eqeqeq
if ((fd == 1 || fd == 2) &&

if ((fd === 1 || fd === 2) &&
(this._handle instanceof Pipe) &&
process.platform === 'win32') {
// Make stdout and stderr blocking on Windows
Expand Down

0 comments on commit f4d5c35

Please sign in to comment.