[entropy.client.interfaces.methods] _create_pid_file_lock: handle the case where execv* has been used

This commit is contained in:
Fabio Erculiani
2011-05-06 12:20:29 +02:00
parent e9fe75b1ca
commit 5cc2ffed2b

View File

@@ -1619,7 +1619,12 @@ class MiscMixin:
if err.errno not in (errno.EACCES, errno.EAGAIN,):
# ouch, wtf?
raise
# lock already acquired, but might come from the same pid
stored_pid = pid_f.read(128).strip()
pid_f.close()
if str(os.getpid()) == stored_pid:
# it's me, entropy (in case I called execv*)
return True
return False # lock already acquired
pid_f.truncate()