-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mkdirall: switch away from O_PATH for mkdir loop
We need to read the list of dirents during the loop, and re-opening and closing the fd each time doesn't really make much sense. O_DIRECTORY should stop us from opening any "bad" inodes, so we might as well make MkdirAllHandle always return an O_DIRECTORY and we can eliminate all of the unneeded reopens. We need to duplicate the handle at the start to make sure we return a non-O_PATH even if we are asked to MkdirAll an existing directory. We can just re-use Reopen now that we have it. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
- Loading branch information
Showing
1 changed file
with
22 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters