Leave pos as undefined to allow reads from unseekable files like /proc/x/smaps on Linux
This commit is contained in:
parent
c9e27b11c5
commit
40820ec8d5
@ -63,7 +63,8 @@ fs.readFile = function (path, encoding_, callback) {
|
|||||||
if (err) {
|
if (err) {
|
||||||
if (callback) callback(err);
|
if (callback) callback(err);
|
||||||
} else {
|
} else {
|
||||||
readAll(fd, 0, "", encoding, callback);
|
// leave pos undefined to allow reads on unseekable devices
|
||||||
|
readAll(fd, undefined, "", encoding, callback);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -73,7 +74,7 @@ fs.readFileSync = function (path, encoding) {
|
|||||||
|
|
||||||
var fd = binding.open(path, process.O_RDONLY, 0666);
|
var fd = binding.open(path, process.O_RDONLY, 0666);
|
||||||
var content = '';
|
var content = '';
|
||||||
var pos = 0;
|
var pos; // leave undefined to allow reads on unseekable devices
|
||||||
var r;
|
var r;
|
||||||
|
|
||||||
while ((r = binding.read(fd, 4*1024, pos, encoding)) && r[0]) {
|
while ((r = binding.read(fd, 4*1024, pos, encoding)) && r[0]) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user