authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-11-26 20:21:53+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-11-26 20:21:53+01:00
loga8f8d8221595a422b61ceca8835c677f6830799d
treefab3e8d1fe904a98558fbb92cb6e0251d3c8590b
parentf125c4f5c795485e3c927c85198828793c1be434

stage2 macho: use Dir.copyFile instead of manual create+copy


1 files changed, 1 insertions(+), 4 deletions(-)

src/link.zig+1-4
......@@ -263,10 +263,7 @@ pub const File = struct {
263263 fs.base64_encoder.encode(&random_sub_path, &random_bytes);
264264 const tmp_file_name = try mem.join(base.allocator, "_", &[_][]const u8{ emit.sub_path, random_sub_path[0..] });
265265 defer base.allocator.free(tmp_file_name);
266 var tmp_file = try emit.directory.handle.createFile(tmp_file_name, .{ .mode = determineMode(base.options) });
267 defer tmp_file.close();
268 const stat = try f.stat();
269 _ = try f.copyRangeAll(0, tmp_file, 0, stat.size);
266 try emit.directory.handle.copyFile(emit.sub_path, emit.directory.handle, tmp_file_name, .{});
270267 try emit.directory.handle.rename(tmp_file_name, emit.sub_path);
271268 }
272269 f.close();