Changed undefined pos to null to prevent hanging on SheevaPlug
authorJonathan Knezek <jdknezek@gmail.com>
Thu, 6 May 2010 05:23:45 +0000 (00:23 -0500)
committerRyan Dahl <ry@tinyclouds.org>
Thu, 6 May 2010 05:34:36 +0000 (22:34 -0700)
lib/fs.js

index 8d17c7f..abb0a5e 100644 (file)
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -63,8 +63,8 @@ fs.readFile = function (path, encoding_, callback) {
     if (err) {
       if (callback) callback(err);
     } else {
-      // leave pos undefined to allow reads on unseekable devices
-      readAll(fd, undefined, "", encoding, callback);
+      // leave pos null to allow reads on unseekable devices
+      readAll(fd, null, "", encoding, callback);
     }
   });
 };
@@ -74,7 +74,7 @@ fs.readFileSync = function (path, encoding) {
 
   var fd = binding.open(path, process.O_RDONLY, 0666);
   var content = '';
-  var pos;   // leave undefined to allow reads on unseekable devices
+  var pos = null;   // leave null to allow reads on unseekable devices
   var r;
 
   while ((r = binding.read(fd, 4*1024, pos, encoding)) && r[0]) {