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

core: Avoid checking if a file exists before opening #8087

Merged

Conversation

Smjert
Copy link
Member

@Smjert Smjert commented Jul 21, 2023

Checking if a file exists before opening it is a pessimization and susceptible to race conditions.
On posix it's enough to open without O_CREAT and if the file doesn't exists the open will return -1.

Checking if a file exists before opening it is a pessimization
and susceptible to race conditions.
On posix it's enough to open without O_CREAT
and if the file doesn't exists the open will return -1.
@Smjert Smjert merged commit b026fd6 into osquery:master Jul 28, 2023
16 checks passed
@Smjert Smjert deleted the stefano/improvement/avoid-stat-on-file-open branch July 28, 2023 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants