From cd37c1a377483154e82dce47b10ab0c54264f4e9 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 21 Nov 2019 17:07:29 -0500 Subject: add std.fs.Dir.openRead This is progress towards file system APIs that encourage avoiding Time Of Check, Time Of Use bugs. --- lib/std/debug.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/std/debug.zig') diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 3cf4306ea5..7698443ce8 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -1711,7 +1711,12 @@ fn getLineNumberInfoMacOs(di: *DebugInfo, symbol: MachoSymbol, target_address: u const ofile_path = mem.toSliceConst(u8, di.strings.ptr + ofile.n_strx); gop.kv.value = MachOFile{ - .bytes = try std.io.readFileAllocAligned(di.ofiles.allocator, ofile_path, @alignOf(macho.mach_header_64)), + .bytes = try std.fs.Dir.cwd().readFileAllocAligned( + di.ofiles.allocator, + ofile_path, + maxInt(usize), + @alignOf(macho.mach_header_64), + ), .sect_debug_info = null, .sect_debug_line = null, }; -- cgit v1.2.3