Show More
@@ -170,6 +170,7 b' def checklink(path):' | |||
|
170 | 170 | """check whether the given path is on a symlink-capable filesystem""" |
|
171 | 171 | # mktemp is not racy because symlink creation will fail if the |
|
172 | 172 | # file already exists |
|
173 | while True: | |
|
173 | 174 | name = tempfile.mktemp(dir=path, prefix='hg-checklink-') |
|
174 | 175 | try: |
|
175 | 176 | fd = tempfile.NamedTemporaryFile(dir=path, prefix='hg-checklink-') |
@@ -177,15 +178,18 b' def checklink(path):' | |||
|
177 | 178 | os.symlink(os.path.basename(fd.name), name) |
|
178 | 179 | os.unlink(name) |
|
179 | 180 | return True |
|
181 | except OSError as inst: | |
|
182 | # link creation might race, try again | |
|
183 | if inst[0] == errno.EEXIST: | |
|
184 | continue | |
|
185 | # sshfs might report failure while successfully creating the link | |
|
186 | if inst[0] == errno.EIO and os.path.exists(name): | |
|
187 | os.unlink(name) | |
|
188 | return False | |
|
180 | 189 | finally: |
|
181 | 190 | fd.close() |
|
182 | 191 | except AttributeError: |
|
183 | 192 | return False |
|
184 | except OSError as inst: | |
|
185 | # sshfs might report failure while successfully creating the link | |
|
186 | if inst[0] == errno.EIO and os.path.exists(name): | |
|
187 | os.unlink(name) | |
|
188 | return False | |
|
189 | 193 | |
|
190 | 194 | def checkosfilename(path): |
|
191 | 195 | '''Check that the base-relative path is a valid filename on this platform. |
General Comments 0
You need to be logged in to leave comments.
Login now