Subject: | Race in setModeFromFile() |
The setModeFromFile() first checks if source file exists and then stats the file and finally it uses the obtained mode. If the file is removed between the check and stat(), bad things will happen.
I recommend completely remove the check for file existence and check if the stat() succeeded (returned non-empty list).