fix(sync): keep sync owner first-claim-wins on Windows
This commit is contained in:
@@ -250,17 +250,15 @@ fn publish_owner(directory: &Dir, temporary: &str) -> io::Result<()> {
|
|||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
/// Windows `rename` replaces an existing target (MOVEFILE_REPLACE_EXISTING
|
||||||
fn publish_owner(directory: &Dir, temporary: &str) -> io::Result<()> {
|
/// semantics), which would let a losing concurrent claim overwrite the
|
||||||
directory.rename(temporary, directory, OWNER_FILE)
|
/// winner. `hard_link` fails with `AlreadyExists` on every platform, so it
|
||||||
}
|
/// preserves first-claim-wins.
|
||||||
|
|
||||||
#[cfg(not(any(
|
#[cfg(not(any(
|
||||||
target_vendor = "apple",
|
target_vendor = "apple",
|
||||||
target_os = "linux",
|
target_os = "linux",
|
||||||
target_os = "android",
|
target_os = "android",
|
||||||
target_os = "redox",
|
target_os = "redox"
|
||||||
windows
|
|
||||||
)))]
|
)))]
|
||||||
fn publish_owner(directory: &Dir, temporary: &str) -> io::Result<()> {
|
fn publish_owner(directory: &Dir, temporary: &str) -> io::Result<()> {
|
||||||
directory.hard_link(temporary, directory, OWNER_FILE)?;
|
directory.hard_link(temporary, directory, OWNER_FILE)?;
|
||||||
|
|||||||
Reference in New Issue
Block a user