Let’s say I have: sample.c
int main (...) {
char str*;
get s through user input
test(str);
return 0;
}
void test (str) {
copy str to new file
change file permissions on new file
close file
}
There’s no possibility of a race condition here since I have no threads in my main() method. Is that true?
There is a kind of race condition in that the user can exchange “new file” immediately before you change permissions of “new file”. This is (was?) an often used security exploit.
I just see that Neil Butterworth had a related idea.