I have a program in C that is writing data to a file.
The C program does not keep the file opened during the execution, It just open the file with ( fopen ("myfile.txt","a")
) and write some data and then close the file.
In other side I have a script file that could make 2 actions on the same file at the same time with The C binary program:
It could remove the file
it could add some lines to the file with the command
echo "some data" >> file
Are there a risk of race condition betwen script and C binary program? Does the Linux ioctl could manage a such issue?
If there is a risk of race condition, how to make a check on C and shell before treating the file?