Here's the scenario:
user connects to a folder via FTP, and uploads a file.
process running on the server detects the file, and starts "processing" it - ie making copies and doing things to it.
while this process is going on, I want to make sure the user doesn't delete it, rename it, or copy over it... I need to lock it until the processing is complete.
I've looked at flock and fcntl, neither seem to do the trick. Maybe I'm not using them right.
I tried this:
# flock example.png LOCK_EX
flock: LOCK_EX: Success
but then, I was able to delete the file via my open FTP connection.
it must be possible to do this... how else does Linux prevent race conditions? but I'm not getting it.