bugfix stale locks

This commit is contained in:
Enno Rehling 2001-11-06 08:44:41 +00:00
parent 29dd35b877
commit ef95b37b9f
1 changed files with 8 additions and 2 deletions

View File

@ -16,8 +16,14 @@ if (trylock(sys.argv[1]+'.err')!=0):
sys.exit()
# move input file then unlock it:
os.rename(sys.argv[1]+'.err', sys.argv[1]+'.tmp')
unlock(sys.argv[1]+'.err')
if os.access(sys.argv[1]+'.err', os.F_OK)==0:
unlock(sys.argv[1]+'.err')
sys.exit();
try:
os.rename(sys.argv[1]+'.err', sys.argv[1]+'.tmp')
finally:
unlock(sys.argv[1]+'.err')
infile=open(sys.argv[1]+".tmp", "r")
server=smtplib.SMTP('localhost')