# lib/std/posix: test ftruncate via std.fs.File.setEndPos\(\) · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/2210c4c3604522ad0b07e15bc2a2d050923161c5)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 2210c4c3604522ad0b07e15bc2a2d050923161c5

Requested commit: 2210c4c3604522ad0b07e15bc2a2d050923161c5

Commit: 2210c4c3604522ad0b07e15bc2a2d050923161c5

Tree: b3a2e60974edcd3f4ffedb574ba3dfce844215ee

Author: Pat Tullmann

Committer: Alex Rønne Petersen

## Message

```
lib/std/posix: test ftruncate via std.fs.File.setEndPos()

Add a test for std.fs.File's `setEndPos` (which is a simple wrapper around
`std.posix.ftruncate`) to exercise some success and failure paths.

Explicitly check that the `ftruncate` length isn't negative when
interpreted as a signed value.  This avoids having to decode overloaded
`EINVAL` errors.

Add errno handling to Windows path to map INVALID_PARAMETER to FileTooBig.

Fixes #22960

```

## Parents

- [1408288b95952b486c8bdce3b1e8eb6910de4cb7](https://git.cafe/gitcafe/zig/commit/1408288b95952b486c8bdce3b1e8eb6910de4cb7?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/2210c4c3604522ad0b07e15bc2a2d050923161c5?format=markdown)
