##// END OF EJS Templates
util: avoid a leaked file descriptor in `util.makelock()` exceptional case
Matt Harbison -
r52781:f833ad92 default
parent child Browse files
Show More
@@ -2201,8 +2201,10 def makelock(info, pathname):
2201 2201
2202 2202 flags = os.O_CREAT | os.O_WRONLY | os.O_EXCL | getattr(os, 'O_BINARY', 0)
2203 2203 ld = os.open(pathname, flags)
2204 os.write(ld, info)
2205 os.close(ld)
2204 try:
2205 os.write(ld, info)
2206 finally:
2207 os.close(ld)
2206 2208
2207 2209
2208 2210 def readlock(pathname: bytes) -> bytes:
General Comments 0
You need to be logged in to leave comments. Login now