Skip to content

Commit

Permalink
Update offset before get_SafeFileHandle returns
Browse files Browse the repository at this point in the history
  • Loading branch information
jozkee committed Mar 22, 2021
1 parent f668035 commit 64e5174
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,15 @@ public override long Position

internal sealed override bool IsPipe => _isPipe;
// Flushing is the responsibility of BufferedFileStreamStrategy
// TODO: we might consider calling FileStreamHelpers.Seek(handle, _path, _filePosition, SeekOrigin.Begin);
// here to set the actual file offset
internal sealed override SafeFileHandle SafeFileHandle => _fileHandle;
internal sealed override SafeFileHandle SafeFileHandle
{
get
{
// Update the file offset in the handle before exposing it.
FileStreamHelpers.Seek(_fileHandle, _path, _filePosition, SeekOrigin.Begin);
return _fileHandle;
}
}

// ReadByte and WriteByte methods are used only when the user has disabled buffering on purpose
// their performance is going to be horrible
Expand Down

0 comments on commit 64e5174

Please sign in to comment.