file: prevent replace failure when overwriting empty directory with hard/link (force=yes)

reviewable/pr18780/r1
RomanDolejsi 10 years ago
parent fe7d092f0b
commit 7cd6d6fb89

@ -233,6 +233,8 @@ def main():
# try to replace atomically
tmppath = '/'.join([os.path.dirname(path), ".%s.%s.tmp" % (os.getpid(),time.time())])
try:
if prev_state == 'directory' and (state == 'hard' or state == 'link'):
os.rmdir(path)
if state == 'hard':
os.link(src,tmppath)
else:

Loading…
Cancel
Save