mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
stage1: fix wasi_snapshot_preview1_fd_seek on cache files
`wasm2c` uses an interesting mechanism to "fake" the existence of cache directories. However, `wasi_snapshot_preview1_fd_seek` was not correctly integrated with this system, so previously crashed when run on a file in a cache directory due to trying to call `fseek` on a `FILE *` which was `NULL`.
This commit is contained in:
parent
87209954a7
commit
d8ac37fcc8
1 changed files with 2 additions and 0 deletions
|
|
@ -1003,6 +1003,8 @@ uint32_t wasi_snapshot_preview1_fd_seek(uint32_t fd, uint64_t in_offset, uint32_
|
||||||
default: panic("unimplemented");
|
default: panic("unimplemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fds[fd].stream == NULL) return wasi_errno_success;
|
||||||
|
|
||||||
int seek_whence;
|
int seek_whence;
|
||||||
switch (whence) {
|
switch (whence) {
|
||||||
case wasi_whence_set:
|
case wasi_whence_set:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue