@@ -310,7 +310,7 @@ ReadFileContext.prototype.read = function() {
310
310
req . oncomplete = readFileAfterRead ;
311
311
req . context = this ;
312
312
313
- binding . read ( this . fd , buffer , offset , length , this . pos , req ) ;
313
+ binding . read ( this . fd , buffer , offset , length , - 1 , req ) ;
314
314
} ;
315
315
316
316
ReadFileContext . prototype . close = function ( err ) {
@@ -447,11 +447,11 @@ function tryCreateBuffer(size, fd, isUserFd) {
447
447
return buffer ;
448
448
}
449
449
450
- function tryReadSync ( fd , isUserFd , buffer , pos , len , offset ) {
450
+ function tryReadSync ( fd , isUserFd , buffer , pos , len ) {
451
451
var threw = true ;
452
452
var bytesRead ;
453
453
try {
454
- bytesRead = fs . readSync ( fd , buffer , pos , len , offset ) ;
454
+ bytesRead = fs . readSync ( fd , buffer , pos , len ) ;
455
455
threw = false ;
456
456
} finally {
457
457
if ( threw && ! isUserFd ) fs . closeSync ( fd ) ;
@@ -480,15 +480,15 @@ fs.readFileSync = function(path, options) {
480
480
481
481
if ( size !== 0 ) {
482
482
do {
483
- bytesRead = tryReadSync ( fd , isUserFd , buffer , pos , size - pos , pos ) ;
483
+ bytesRead = tryReadSync ( fd , isUserFd , buffer , pos , size - pos ) ;
484
484
pos += bytesRead ;
485
485
} while ( bytesRead !== 0 && pos < size ) ;
486
486
} else {
487
487
do {
488
488
// the kernel lies about many files.
489
489
// Go ahead and try to read some bytes.
490
490
buffer = Buffer . allocUnsafe ( 8192 ) ;
491
- bytesRead = tryReadSync ( fd , isUserFd , buffer , 0 , 8192 , pos ) ;
491
+ bytesRead = tryReadSync ( fd , isUserFd , buffer , 0 , 8192 ) ;
492
492
if ( bytesRead !== 0 ) {
493
493
buffers . push ( buffer . slice ( 0 , bytesRead ) ) ;
494
494
}
0 commit comments