| author | |
| committer | |
| log | ceb84c647b5cf6ad6a17b829a78e1c079a6ab5a5 |
| tree | 83afdd3b230ba1f28b4a51a5862f73dcf1a68e68 |
| parent | 40891348923e48cbf371db5227acea7bb8b263aa |
| signature |
`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`.1 files changed, 2 insertions(+), 0 deletions(-)
stage1/wasi.c+2| ... | @@ -1003,6 +1003,8 @@ uint32_t wasi_snapshot_preview1_fd_seek(uint32_t fd, uint64_t in_offset, uint32_ | ... | @@ -1003,6 +1003,8 @@ uint32_t wasi_snapshot_preview1_fd_seek(uint32_t fd, uint64_t in_offset, uint32_ |
| 1003 | default: panic("unimplemented"); | 1003 | default: panic("unimplemented"); |
| 1004 | } | 1004 | } |
| 1005 | 1005 | ||
| 1006 | if (fds[fd].stream == NULL) return wasi_errno_success; | ||
| 1007 | |||
| 1006 | int seek_whence; | 1008 | int seek_whence; |
| 1007 | switch (whence) { | 1009 | switch (whence) { |
| 1008 | case wasi_whence_set: | 1010 | case wasi_whence_set: |