Skip to content

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
@jarun
Copy link
Owner

jarun commented Apr 5, 2024

Makes sense. Merged. Thanks!

@jarun jarun mentioned this pull request Apr 13, 2024
10 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.

4 participants