Skip to content

Fix using wrong streams on seek - #916

Merged
alexcrichton merged 1 commit into
WebAssembly:mainfrom
alexcrichton:fix-lseek
Nov 16, 2026
Merged

alexcrichton merged 1 commit into
WebAssembly:mainfrom
alexcrichton:fix-lseek

Conversation

@alexcrichton

Copy link
Copy Markdown
Collaborator

This commit fixes an issue with the implementation of SEEK_END where the helper used to calculate the size of a file updated the internal offset of a file, meaning that lseek's check of "do the streams need closing" was broken because the position of the streams was out of sync with the listed offset in the file.

Closes #913

This commit fixes an issue with the implementation of `SEEK_END` where
the helper used to calculate the size of a file updated the internal
offset of a file, meaning that `lseek`'s check of "do the streams need
closing" was broken because the position of the streams was out of sync
with the listed offset in the file.

Closes WebAssembly#913
@alexcrichton
alexcrichton merged commit f762ab4 into WebAssembly:main Nov 16, 2026
142 of 148 checks passed
@alexcrichton
alexcrichton deleted the fix-lseek branch November 16, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wasip2: lseek(fd, 0, SEEK_END) leaves the old output stream active and overwrites data

2 participants