__del__ pattern?

BranoZ zarnovican at gmail.com
Wed Aug 17 01:29:39 CEST 2005


bryanjugglercryptographer at yahoo.com wrote:
> For a reasonably portable solution, leave the lock file open.
> On most systems, you cannot delete an open file,..
On most UNIXes, you can delete an open file.
Even flock-ed. This is BTW also an hack around flock.

1. Process A opens file /var/tmp/test1, and flocks descriptor.
2. Process H unlinks /var/tmp/test1
3. Process B opens file /var/tmp/test1, and flocks _another_
  descriptor
4. Processes A and B are running simultaneously

Do you need protection agains H ?

Use file that is writeable by A and B in a directory that is
writeable only by root.

BranoZ




More information about the Python-list mailing list