file: prevent replace failure when overwriting empty directory with hard/link (force=yes)
This commit is contained in:
parent
a9f0f8e975
commit
fcf7f03398
1 changed files with 2 additions and 0 deletions
|
@ -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…
Reference in a new issue