diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/_debugger.js | 4 | ||||
-rw-r--r-- | lib/_tls_legacy.js | 5 | ||||
-rw-r--r-- | lib/fs.js | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/lib/_debugger.js b/lib/_debugger.js index 2613d8bbbe..4dd9f53633 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -1367,7 +1367,9 @@ Interface.prototype.setBreakpoint = function(script, line, if (script != +script && !this.client.scripts[script]) { var scripts = this.client.scripts; Object.keys(scripts).forEach(function(id) { - if (scripts[id] && scripts[id].name.indexOf(script) !== -1) { + if (scripts[id] && + scripts[id].name && + scripts[id].name.indexOf(script) !== -1) { if (scriptId) { ambiguous = true; } diff --git a/lib/_tls_legacy.js b/lib/_tls_legacy.js index 9792b8927a..a42a3802dc 100644 --- a/lib/_tls_legacy.js +++ b/lib/_tls_legacy.js @@ -275,10 +275,9 @@ CryptoStream.prototype._read = function read(size) { var bytesRead = 0, start = this._buffer.offset; do { - var read = this._buffer.use(this.pair.ssl, out, size); + var read = this._buffer.use(this.pair.ssl, out, size - bytesRead); if (read > 0) { bytesRead += read; - size -= read; } // Handle and report errors @@ -831,7 +830,7 @@ exports.pipe = function pipe(pair, socket) { // Encrypted should be unpiped from socket to prevent possible // write after destroy. pair.encrypted.unpipe(socket); - socket.destroy(); + socket.destroySoon(); }); }); @@ -543,7 +543,7 @@ fs.truncate = function(path, len, callback) { len = 0; } callback = maybeCallback(callback); - fs.open(path, 'w', function(er, fd) { + fs.open(path, 'r+', function(er, fd) { if (er) return callback(er); binding.ftruncate(fd, len, function(er) { fs.close(fd, function(er2) { @@ -562,7 +562,7 @@ fs.truncateSync = function(path, len) { len = 0; } // allow error to be thrown, but still close fd. - var fd = fs.openSync(path, 'w'); + var fd = fs.openSync(path, 'r+'); try { var ret = fs.ftruncateSync(fd, len); } finally { |