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 file creation on OpenBSD #1864

Merged
merged 1 commit into from
Apr 5, 2024
Merged

Fix file creation on OpenBSD #1864

merged 1 commit into from
Apr 5, 2024

Conversation

horrad
Copy link
Contributor

@horrad horrad commented Apr 4, 2024

On OpenBSD at least one of O_RDONLY, O_WRONLY or O_RDWR is needed to open a file.

In creating a new file none of those is set, which leads to an EINVAL error ("invalid argument").

Since the new file is only created and never read, I chose to use O_WRONLY.

@N-R-K
Copy link
Collaborator

N-R-K commented Apr 4, 2024

@horrad Please put what you wrote in the PR description in the commit message body as well.

On OpenBSD at least one of O_RDONLY, O_WRONLY or O_RDWR is needed to open a file.

In creating a new file none of those is set, which leads to an EINVAL error ("invalid argument").

Since the new file is only created and never read, I chose to use O_WRONLY.
@horrad
Copy link
Contributor Author

horrad commented Apr 4, 2024

@horrad Please put what you wrote in the PR description in the commit message body as well.
Done.

@jarun
Copy link
Owner

jarun commented Apr 5, 2024

Can you please make the patch BSD-specific?

@KlzXS
Copy link
Collaborator

KlzXS commented Apr 5, 2024

I think it's best we avoid adding unnecessary #ifdefs. open(2) says:

The argument flags must include one of the following access
modes: O_RDONLY, O_WRONLY, or O_RDWR.

We have none of those.

@jarun jarun merged commit 5853ac8 into jarun:master Apr 5, 2024
7 checks passed
@jarun
Copy link
Owner

jarun commented Apr 5, 2024

Makes sense. Merged. Thanks!

@jarun jarun mentioned this pull request Apr 13, 2024
19 tasks
@github-actions github-actions bot locked and limited conversation to collaborators May 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants