Description
Precisely, size as off64_t
. The conversion occurs here
On my system off64_t
is i64
. This means that the number will overflow if larger than i64::max_value()
and become negative. In such case, ftruncate
will return an EINVAL
: (from man ftruncate
:
EINVAL The argument length is negative or larger than the maximum file size.
Should we manually return an error should an overflow occur or is the EINVAL
returned by ftruncate
the intended behavior? I would return an io::ErrorKind::InvalidInput
with the payload indicating that an overflow occured (or even just TryFromIntError(())
which try_into
returns)
This issue was noticed while discussing CraneStation/wasi-common#47.
cc @alexcrichton
I will implement the fix once we've decided what kind of behavior we want.