Created
May 20, 2010 23:14
-
-
Save ry/408253 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 2dac1a1a2ed79cbbc9c80d8a10fcdb511c013341 | |
Author: Ryan Dahl <ry@tinyclouds.org> | |
Date: Thu May 20 15:45:07 2010 -0700 | |
fix global var leak | |
diff --git a/lib/fs.js b/lib/fs.js | |
index fc0843b..3ea6e07 100644 | |
--- a/lib/fs.js | |
+++ b/lib/fs.js | |
@@ -147,16 +147,14 @@ fs.read = function (fd, buffer, offset, length, position, callback) { | |
if (!(buffer instanceof Buffer)) { | |
// legacy string interface (fd, length, position, encoding, callback) | |
var cb = arguments[4]; | |
- encoding = arguments[3]; | |
+ var encoding = arguments[3]; | |
position = arguments[2]; | |
length = arguments[1]; | |
buffer = new Buffer(length); | |
offset = 0; | |
callback = function(err, bytesRead) { | |
- if (!cb) { | |
- return; | |
- } | |
+ if (!cb) return; | |
var str = (bytesRead > 0) | |
? buffer.toString(encoding, 0, bytesRead) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment