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 <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
cjihrig authored and rvagg committed Feb 28, 2019
1 parent ea548d5 commit cd722e2
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 @@ -275,11 +275,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 cd722e2

Please sign in to comment.