ftruncate
has unreachable error values that can be reached
#22960
Labels
bug
Observed behavior contradicts documented or intended behavior
contributor friendly
This issue is limited in scope and/or knowledge of Zig internals.
standard library
This issue involves writing Zig code for the standard library.
Milestone
Zig Version
0.13.0
Steps to Reproduce and Observed Behavior
On Linux:
ftruncate(<my_valid_handle>, <max u64>)
This triggers the
.INVAL
error has which triggers anunreachable
Expected Behavior
From the manual page on man7.org
`The ftruncate() function shall fail if:
`
As shown, there are three possible cases where an
EINVAL
is returned. The zig type system prevents negative length(passed type isu64
), so we can ignore that. As theftruncate
function indicates// Handle not open for writing
at.INVAL
I can assume that is not possible. If that is the case, the only way to triggerEINVAL
is by a length exceeding maximum file size. Therefore.INVAL
should do the following:return error.FileTooBig
, mirroring.FBIG
behavior.The text was updated successfully, but these errors were encountered: