Fix incorrect io::Take's limit resulting from io::copy specialization by the8472...
source link: https://github.com/rust-lang/rust/pull/79650
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Contributor
the8472 commented 17 days ago
The specialization introduced in #75272 fails to update io::Take
wrappers after performing the copy syscalls which bypass those wrappers. The buffer flushing before the copy does update them correctly, but the bytes copied after the initial flush weren't subtracted.
The fix is to subtract the bytes copied from each Take
in the chain of wrappers, even when an error occurs during the syscall loop. To do so the CopyResult
enum now has to carry the bytes copied so far in the error case.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK