diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-03-01 22:55:47 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-03-15 10:48:13 -0700 |
| commit | d0f675827c28b1d50e8aea6a7d29cb45ad8d4e67 (patch) | |
| tree | 7082febc976cdfc9f7149fbe5bbeab3c16a16690 /src/link.zig | |
| parent | b465dc12349dd24fe060e69ad6eb290ddbb3739e (diff) | |
| download | zig-d0f675827c28b1d50e8aea6a7d29cb45ad8d4e67.tar.gz zig-d0f675827c28b1d50e8aea6a7d29cb45ad8d4e67.zip | |
link: only write manifest if we have the exclusive lock
Fixes assertion tripping when racing multiple processes that will create
the same static archive.
Diffstat (limited to 'src/link.zig')
| -rw-r--r-- | src/link.zig | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/link.zig b/src/link.zig index a2f40eed65..96931dd79e 100644 --- a/src/link.zig +++ b/src/link.zig @@ -1078,9 +1078,11 @@ pub const File = struct { log.warn("failed to save archive hash digest file: {s}", .{@errorName(err)}); }; - man.writeManifest() catch |err| { - log.warn("failed to write cache manifest when archiving: {s}", .{@errorName(err)}); - }; + if (man.have_exclusive_lock) { + man.writeManifest() catch |err| { + log.warn("failed to write cache manifest when archiving: {s}", .{@errorName(err)}); + }; + } base.lock = man.toOwnedLock(); } |
