# std.fs.File: Fix metadata error check on Linux · gitcafe/zig

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

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

Visibility: public

Requested revision: a916bc7fdd3975a9e2ef13c44f814c71ce017193

Requested commit: a916bc7fdd3975a9e2ef13c44f814c71ce017193

Commit: a916bc7fdd3975a9e2ef13c44f814c71ce017193

Tree: 8242d9f1b869b0ddf2dbca8680d245eb5c9660d1

Author: Archit Gupta

Committer: Alex Rønne Petersen

## Message

```
std.fs.File: Fix metadata error check on Linux

On Linux, File.metadata calls the statx syscall directly. As such, the
return value is the error code. Previously, it handled the error with
`posix.errno`, which when libc is linked, treats the return value as a
value set to -1 if there is an error with the error code in errno. If
libc wasn't linked, it would be handled correctly.

In the Linux with libc linked case, this would cause the error result to
always be treated as success (err val != -1), even when an error
occurred.

```

## Parents

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

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