diff options
author | Steven Gabarro <bewchabbacc@gmail.com> | 2018-11-07 05:54:13 -0500 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-11-13 16:08:03 -0800 |
commit | 98278584ee2c322655849e6d673ac1739e720b53 (patch) | |
tree | 45523b9f6e328c06584978dd9da2bf1355bfb726 /lib | |
parent | ff566276da239a8d2ecc2ebb93719b2242c2b749 (diff) | |
download | android-node-v8-98278584ee2c322655849e6d673ac1739e720b53.tar.gz android-node-v8-98278584ee2c322655849e6d673ac1739e720b53.tar.bz2 android-node-v8-98278584ee2c322655849e6d673ac1739e720b53.zip |
net: add comments explaining error check
PR-URL: https://github.com/nodejs/node/pull/24222
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/net.js b/lib/net.js index 743e9c8bfb..2bdf1b81ad 100644 --- a/lib/net.js +++ b/lib/net.js @@ -264,9 +264,16 @@ function Socket(options) { const { fd } = options; let err; + // createHandle will throw ERR_INVALID_FD_TYPE if `fd` is not + // a valid `PIPE` or `TCP` descriptor this._handle = createHandle(fd, false); err = this._handle.open(fd); + + // While difficult to fabricate, in some architectures + // `open` may return an error code for valid file descriptors + // which cannot be opened. This is difficult to test as most + // un-openable fds will throw on `createHandle` if (err) throw errnoException(err, 'open'); |