From bb675baaa985d5f56d8e5936da9b356ec4a57f11 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Tue, 8 May 2012 20:17:54 +0200 Subject: [PATCH] net.js: don't pretend that everything is okay when unwrapping fails In case of an UNWRAP failure, the binding returns -1, which is truthy. --- lib/net.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net.js b/lib/net.js index 3acaf8a130b..4ebc940c3c3 100644 --- a/lib/net.js +++ b/lib/net.js @@ -512,7 +512,7 @@ Socket.prototype._write = function(data, encoding, cb) { // `encoding` is unused right now, `data` is always a buffer. var writeReq = this._handle.write(data); - if (!writeReq) { + if (!writeReq || typeof writeReq !== 'object') { this._destroy(errnoException(errno, 'write'), cb); return false; }