I have made a utility like tcpdump which sniff the RTP packets for specified ports on the network. I am buffering RTP packets and writing these packets into pcap file and compressing in gz format.
While writing into the file (means the file is busy in writing), If user try to delete the same file, Linux is allowing deletion of file without any warning or error.
So please can you suggest me how can I lock this file so the user will not be able to delete the file while writing. And after closing the file if user delete the file then it wil be fine for my application.
I do not want to lock/protect the file from command line using chmod/chattr because I am writing files of size 1MB and once the file size reaches 1MB I will be opening the new file so there will be large number of files of size 1MB and it will be difficult to protect the file using command prompt and again unprotect each and every file.
Thanks & Regards,