Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
posix: remove R_OK from InodeMustBeSearchableDir()
Checking for read permissions (via R_OK) in InodeMustBeSearchableDir() is either redundant or incorrect. Remove it. Assume dirfd is a file descriptor for a directory whose permission bits are 0111 (i.e., search permissions only). Consider the following API calls: 1. red_openat(dirfd, "..", RED_O_RDONLY) 2. red_openat(dirfd, "./..", RED_O_RDONLY) 3. red_openat(dirfd, ".", RED_O_RDONLY) Both #1 and #2 should succeed (assuming dirfd's parent directory has read permissions). However, InodeMustBeSearchableDir() would cause both #1 and #2 to fail, since it will check whether dirfd has read permissions, even though those aren't required. Case #3 should fail, and does fail, but InodeMustBeSearchableDir() does not need to be the place where this failure originates, because the check for read permissions will occur later, in FildesOpen(). The R_OK check in InodeMustBeSearchableDir() is redundant. See also commit 80c2c79, the origin of the relevant code.
- Loading branch information