Skip to content

Commit 4daec65

Browse files
authored
tweak comments
1 parent e63bd68 commit 4daec65

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/backends/wasi_p1.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extern "C" {
1212
}
1313

1414
/// WASI p1 uses `u16` for error codes in its witx definitions:
15-
/// https://github.com/WebAssembly/WASI/blob/38454e9e22013cd00ea04916f556beb9e6d96cec/legacy/preview1/witx/typenames.witx#L39
15+
/// https://github.com/WebAssembly/WASI/blob/38454e9e/legacy/preview1/witx/typenames.witx#L34-L39
1616
const MAX_ERROR_CODE: i32 = u16::MAX as i32;
1717

1818
#[inline]
@@ -25,6 +25,7 @@ pub fn fill_inner(dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
2525
let ret = unsafe { random_get(dest.as_mut_ptr() as i32, dest.len() as i32) };
2626
match ret {
2727
0 => Ok(()),
28+
// WASI functions should return positive error codes which are smaller than `MAX_ERROR_CODE`
2829
code if code <= MAX_ERROR_CODE => Err(Error::from_neg_error_code(-code)),
2930
_ => Err(Error::UNEXPECTED),
3031
}

0 commit comments

Comments
 (0)