##// END OF EJS Templates
Don't step into an endless loop when lock file is empty.
Thomas Arendsen Hein -
r3686:4308f4cd default
parent child Browse files
Show More
@@ -71,7 +71,7 b' class lock(object):'
71 71 except (OSError, IOError), why:
72 72 if why.errno == errno.EEXIST:
73 73 locker = self.testlock()
74 if locker:
74 if locker is not None:
75 75 raise LockHeld(errno.EAGAIN, self.f, self.desc,
76 76 locker)
77 77 else:
@@ -79,11 +79,16 b' class lock(object):'
79 79 why.filename, self.desc)
80 80
81 81 def testlock(self):
82 '''return id of locker if lock is valid, else None.'''
83 # if old-style lock, we cannot tell what machine locker is on.
84 # with new-style lock, if locker is on this machine, we can
85 # see if locker is alive. if locker is on this machine but
86 # not alive, we can safely break lock.
82 """return id of locker if lock is valid, else None.
83
84 If old-style lock, we cannot tell what machine locker is on.
85 with new-style lock, if locker is on this machine, we can
86 see if locker is alive. If locker is on this machine but
87 not alive, we can safely break lock.
88
89 The lock file is only deleted when None is returned.
90
91 """
87 92 locker = util.readlock(self.f)
88 93 try:
89 94 host, pid = locker.split(":", 1)
General Comments 0
You need to be logged in to leave comments. Login now