Skip to content

Commit

Permalink
[wasi] fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MacroModel committed Aug 15, 2024
1 parent 2fb9ab1 commit 9513134
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/vm/interpreter/wasi/wasi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1909,11 +1909,14 @@ namespace uwvm::vm::interpreter::wasi
return static_cast<::std::int_least32_t>(::uwvm::vm::interpreter::wasi::errno_t::eaddrnotavail);
}

::fast_io::freestanding::my_memset(cvt_begin, 0, 4);
constexpr auto le_1{::fast_io::little_endian(static_cast<::std::uint_least32_t>(-1))};
::fast_io::freestanding::my_memcpy(cvt_begin, __builtin_addressof(le_1), sizeof(le_1));
::fast_io::freestanding::my_memset(cvt_begin + 4, 0, 8);

::std::uint_least32_t sz{1u};
auto const le_1{::fast_io::little_endian(sz)};
::fast_io::freestanding::my_memcpy(cvt_begin + 4, __builtin_addressof(le_1), sizeof(le_1));
if(arg0 >= ::uwvm::vm::interpreter::wasi::wasi_fd_limit) [[unlikely]]
{
return static_cast<::std::int_least32_t>(::uwvm::vm::interpreter::wasi::errno_t::ebadf);
}

return static_cast<::std::int_least32_t>(::uwvm::vm::interpreter::wasi::errno_t::esuccess);
}
Expand Down Expand Up @@ -1960,10 +1963,6 @@ namespace uwvm::vm::interpreter::wasi

if(cvt_length == 0) [[unlikely]] { return static_cast<::std::int_least32_t>(::uwvm::vm::interpreter::wasi::errno_t::einval); }

decltype(auto) temp_str{u8"."};

::fast_io::freestanding::my_memcpy(cvt_begin, temp_str, sizeof(temp_str));

return static_cast<::std::int_least32_t>(::uwvm::vm::interpreter::wasi::errno_t::esuccess);
}

Expand Down

0 comments on commit 9513134

Please sign in to comment.