Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unhandled UnsupportedOperationException in Fallocate #1008

Closed
wants to merge 2 commits into from

Conversation

torusrxxx
Copy link
Contributor

No description provided.

} else {
if (Platform.isWindows()) {
// On Windows, just write a byte at the end.
channel.write(ByteBuffer.allocate(1), final_filesize - 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this safe?

try {
return new Fallocate(channel, getDescriptor(channel), final_filesize);
} catch (final UnsupportedOperationException exception) {
return new Fallocate(channel, 0, final_filesize);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to have a comment here that explains why 0 is the right file descriptor.

@ArneBab
Copy link
Contributor

ArneBab commented Nov 29, 2024

Please stick to the original indentation style. Re-indenting the file breaks annotations to trace changes to commits.

That said: Thank you for working on this!

@torusrxxx
Copy link
Contributor Author

Recreated in #1010

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.

2 participants