-
Notifications
You must be signed in to change notification settings - Fork 245
Description
Describe the bug
If you don't have read access to a file then OS_chmod will not be able to change it. This is most likely caused by chmod opening the file as a way to avoid filename race potential, see the code snip.
To Reproduce
- Set the file access to write only.
- Try to change the access using OS_chmod
- will get an OS_ERROR
Expected behavior
You should be able to change the permissions of a file without read access.
Code snips
osal/src/os/portable/os-impl-posix-files.c
Lines 201 to 206 in 1a82657
| /* Open file to avoid filename race potential */ | |
| fd = open(local_path, O_RDONLY); | |
| if (fd < 0) | |
| { | |
| return OS_ERROR; | |
| } |
System observed on:
Ubuntu 20.04
Reporter Info
Alex Campbell GSFC