##// END OF EJS Templates
checknlink: rename file object from 'fd' to 'fp'...
Jun Wu -
r34086:6c5cdb02 default
parent child Browse files
Show More
@@ -1457,24 +1457,23 b' def checknlink(testfile):'
1457 1457
1458 1458 # testfile may be open, so we need a separate file for checking to
1459 1459 # work around issue2543 (or testfile may get lost on Samba shares)
1460 f1, f2, fd = None, None, None
1460 f1, f2, fp = None, None, None
1461 1461 try:
1462 1462 fd, f1 = tempfile.mkstemp(prefix='.%s-' % os.path.basename(testfile),
1463 1463 suffix='1~', dir=os.path.dirname(testfile))
1464 1464 os.close(fd)
1465 fd = None
1466 1465 f2 = '%s2~' % f1[:-2]
1467 1466
1468 1467 oslink(f1, f2)
1469 1468 # nlinks() may behave differently for files on Windows shares if
1470 1469 # the file is open.
1471 fd = posixfile(f2)
1470 fp = posixfile(f2)
1472 1471 return nlinks(f2) > 1
1473 1472 except OSError:
1474 1473 return False
1475 1474 finally:
1476 if fd is not None:
1477 fd.close()
1475 if fp is not None:
1476 fp.close()
1478 1477 for f in (f1, f2):
1479 1478 try:
1480 1479 if f is not None:
General Comments 0
You need to be logged in to leave comments. Login now