Skip to content

Conversation

@navi-desu
Copy link
Member

the exists() helper uses stat.2 unnecessarily, while calling access is simpler and does not require filling a struct stat for no reason.

since this would make exists() into a wrapper that calls a single function and nothing else, let's just inline the calls to access and remove the helper.


{f,}open and setmntent will already fail if the file does not exists, no need for an extra syscall


plus the removal of unused functions, and inlining is_writable, since it's only called once, and it just a wrapper for access as well

the exists() helper uses stat.2 unnecessarily, while calling access is
simpler and does not require filling a struct stat for no reason.

since this would make exists() into a wrapper that calls a single
function and nothing else, let's just inline the calls to access and
remove the helper.
{f,}open and setmntent will already fail if the file does not exists, no
need for an extra syscall
only one consumer, checkpath, and can easily be done directly with the
access syscall
Copy link
Contributor

@N-R-K N-R-K left a comment

Choose a reason for hiding this comment

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

Untested, but looks okay.

@navi-desu navi-desu merged commit ec00ad7 into master Jun 16, 2025
10 checks passed
@navi-desu navi-desu deleted the use-access branch June 16, 2025 08:53
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.

3 participants