mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
macho+zld: clean up opening and closing of file descriptors
This commit is contained in:
parent
76afdd0586
commit
ee705e3ac7
@ -3665,16 +3665,17 @@ pub fn linkWithZld(macho_file: *MachO, comp: *Compilation, prog_node: *std.Progr
|
||||
} else {
|
||||
const page_size = macho_file.page_size;
|
||||
const sub_path = options.emit.?.sub_path;
|
||||
if (macho_file.base.file == null) {
|
||||
macho_file.base.file = try directory.handle.createFile(sub_path, .{
|
||||
.truncate = true,
|
||||
.read = true,
|
||||
.mode = link.determineMode(options.*),
|
||||
});
|
||||
}
|
||||
|
||||
const file = try directory.handle.createFile(sub_path, .{
|
||||
.truncate = true,
|
||||
.read = true,
|
||||
.mode = link.determineMode(options.*),
|
||||
});
|
||||
defer file.close();
|
||||
|
||||
var zld = Zld{
|
||||
.gpa = gpa,
|
||||
.file = macho_file.base.file.?,
|
||||
.file = file,
|
||||
.page_size = macho_file.page_size,
|
||||
.options = options,
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user