mirror of
https://github.com/ziglang/zig.git
synced 2025-12-25 23:53:15 +00:00
Fixes atomicSymLink looping when new_path already exists.
This commit is contained in:
parent
d726c2a2d3
commit
606b6462ce
@ -84,7 +84,7 @@ pub fn atomicSymLink(allocator: *Allocator, existing_path: []const u8, new_path:
|
||||
try crypto.randomBytes(rand_buf[0..]);
|
||||
base64_encoder.encode(tmp_path[dirname.len + 1 ..], &rand_buf);
|
||||
|
||||
if (cwd().symLink(existing_path, new_path, .{})) {
|
||||
if (cwd().symLink(existing_path, tmp_path, .{})) {
|
||||
return rename(tmp_path, new_path);
|
||||
} else |err| switch (err) {
|
||||
error.PathAlreadyExists => continue,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user