Skip to content

Conversation

@matil019
Copy link
Contributor

@matil019 matil019 commented Apr 17, 2022

Resolves #156

This commit introduces a CPP guard to take care of the difference between OSes of the errors of posix_fallocate.

Update: No conditionals are added, just the error handler is updated to correctly handle the error value returned by posix_fallocate.

@matil019 matil019 changed the title Fix the error handling of posix_fallocate other than FreeBSD Fix the error handling of posix_fallocate Apr 17, 2022
@hs-viktor
Copy link
Contributor

CI failed, but I just merged a CI fix PR. Perhaps rebasing will resolve the issue. Please rebase.

This commit introduces a CPP guard to take care of the difference
between OSes of the errors of posix_fallocate.

On Linux and NetBSD, posix_fallocate reports error by returning an error
number. errno is not set.
On the other hand, on FreeBSD, posix_fallocate returns -1 and sets
errno.

The existing code could handle FreeBSD-style errors only.
The FreeBSD-style error (return -1, set errno) is obsolete as of
FreeBSD 11.0; it now reports errors as same as the other OSes.
@matil019 matil019 force-pushed the fileallocate-error branch from bc10aec to e8dda97 Compare April 18, 2022 01:07
@matil019
Copy link
Contributor Author

Rebased.

@hs-viktor
Copy link
Contributor

Forgot about the haskell.org outage, will have to retry the CI later...

@Bodigrim
Copy link
Contributor

CI is all green.

@Bodigrim Bodigrim requested a review from hs-viktor April 19, 2022 21:52
@hs-viktor hs-viktor merged commit 50a7211 into haskell:master Apr 19, 2022
@matil019 matil019 deleted the fileallocate-error branch April 20, 2022 00:49
@Bodigrim Bodigrim added this to the 2.8.0.0 milestone Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fileAllocate handles errors incorrectly on some systems

4 participants