comparison mercurial/posix.py @ 37934:2d919ab6c5b4

posix: use inst.errno instead of inst[0] on OSError instances Differential Revision: https://phab.mercurial-scm.org/D3523
author Augie Fackler <augie@google.com>
date Fri, 27 Apr 2018 13:26:43 -0400
parents a6c6b7beb025
children aac4be30e250
comparison
equal deleted inserted replaced
37933:f71c97d9b97b 37934:2d919ab6c5b4
285 except OSError: 285 except OSError:
286 unlink(name) 286 unlink(name)
287 return True 287 return True
288 except OSError as inst: 288 except OSError as inst:
289 # link creation might race, try again 289 # link creation might race, try again
290 if inst[0] == errno.EEXIST: 290 if inst.errno == errno.EEXIST:
291 continue 291 continue
292 raise 292 raise
293 finally: 293 finally:
294 if fd is not None: 294 if fd is not None:
295 fd.close() 295 fd.close()
296 except AttributeError: 296 except AttributeError:
297 return False 297 return False
298 except OSError as inst: 298 except OSError as inst:
299 # sshfs might report failure while successfully creating the link 299 # sshfs might report failure while successfully creating the link
300 if inst[0] == errno.EIO and os.path.exists(name): 300 if inst.errno == errno.EIO and os.path.exists(name):
301 unlink(name) 301 unlink(name)
302 return False 302 return False
303 303
304 def checkosfilename(path): 304 def checkosfilename(path):
305 '''Check that the base-relative path is a valid filename on this platform. 305 '''Check that the base-relative path is a valid filename on this platform.