Comments
Patch
@@ -168,9 +168,8 @@
def checklink(path):
"""check whether the given path is on a symlink-capable filesystem"""
- # mktemp is not racy because symlink creation will fail if the
- # file already exists
- name = tempfile.mktemp(dir=path, prefix='hg-checklink-')
+ tmpdir = tempfile.mkdtemp(dir=path, prefix='hg-checklink-')
+ name = os.path.join(tmpdir, 'link')
try:
fd = tempfile.NamedTemporaryFile(dir=path, prefix='hg-checklink-')
try:
@@ -179,6 +178,7 @@
return True
finally:
fd.close()
+ os.rmdir(tmpdir)
except AttributeError:
return False
except OSError as inst: