comparison mercurial/util.py @ 10901:997173e49115 stable

checklink: use an explicit prefix for the temporary file
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Wed, 14 Apr 2010 08:48:26 +0200
parents 2d61b612a09d
children cd21bf199d17 18e81d42ee5c
comparison
equal deleted inserted replaced
10896:2d61b612a09d 10901:997173e49115
680 680
681 def checklink(path): 681 def checklink(path):
682 """check whether the given path is on a symlink-capable filesystem""" 682 """check whether the given path is on a symlink-capable filesystem"""
683 # mktemp is not racy because symlink creation will fail if the 683 # mktemp is not racy because symlink creation will fail if the
684 # file already exists 684 # file already exists
685 name = tempfile.mktemp(dir=path) 685 name = tempfile.mktemp(dir=path, prefix='hg-checklink-')
686 try: 686 try:
687 os.symlink(".", name) 687 os.symlink(".", name)
688 os.unlink(name) 688 os.unlink(name)
689 return True 689 return True
690 except (OSError, AttributeError): 690 except (OSError, AttributeError):