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.
This commit is contained in:
Bert Belder 2012-05-08 20:17:54 +02:00
Родитель 29b2fdb0c5
Коммит bb675baaa9
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -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;
}