flake
This commit is contained in:
parent
f6c895ce10
commit
d9637751cb
@ -33,7 +33,7 @@ def atomic_update(oldpath, newpath):
|
|||||||
on other systems, oldpath is not affected but all paths are abstracted
|
on other systems, oldpath is not affected but all paths are abstracted
|
||||||
by a symlink to allow for atomic updates.
|
by a symlink to allow for atomic updates.
|
||||||
"""
|
"""
|
||||||
if has_renameat2():
|
if renameat2:
|
||||||
return atomic_update_renameat2(oldpath, newpath)
|
return atomic_update_renameat2(oldpath, newpath)
|
||||||
else:
|
else:
|
||||||
return atomic_update_symlink(oldpath, newpath)
|
return atomic_update_symlink(oldpath, newpath)
|
||||||
@ -48,7 +48,7 @@ def atomic_update_renameat2(src, dest):
|
|||||||
if not dest_exists:
|
if not dest_exists:
|
||||||
fs.touch(dest)
|
fs.touch(dest)
|
||||||
try:
|
try:
|
||||||
rc = libc.renameat2(AT_FDCWD, src.encode(), AT_FDCWD, dest.encode(), RENAME_EXCHANGE)
|
rc = renameat2(AT_FDCWD, src.encode(), AT_FDCWD, dest.encode(), RENAME_EXCHANGE)
|
||||||
if rc:
|
if rc:
|
||||||
raise OSError(f"renameat2 failed to exchange {src} and {dest}")
|
raise OSError(f"renameat2 failed to exchange {src} and {dest}")
|
||||||
if not dest_exists:
|
if not dest_exists:
|
||||||
|
Loading…
Reference in New Issue
Block a user