authorgravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2020-05-12 15:53:33-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-05-16 12:41:53-04:00
loge05923f34b566a47d81ee955ec170a855ac99a1d
tree8091827cc93d156ecf9bb76f9ae458c7087e1069
parent79462bb5916d1e6459e73950dbab444e5b949853

macos: use realpath$DARWIN_EXTSN

macOS 10.15 Catalina causes an ancient variant of `realpath` to fail, likely due to 10.15's evolving security model. closes #5325

2 files changed, 12 insertions(+), 1 deletions(-)

lib/std/c.zig+10-1
......@@ -111,7 +111,16 @@ pub extern "c" fn dup(fd: fd_t) c_int;
111111pub extern "c" fn dup2(old_fd: fd_t, new_fd: fd_t) c_int;
112112pub extern "c" fn readlink(noalias path: [*:0]const u8, noalias buf: [*]u8, bufsize: usize) isize;
113113pub extern "c" fn readlinkat(dirfd: fd_t, noalias path: [*:0]const u8, noalias buf: [*]u8, bufsize: usize) isize;
114pub extern "c" fn realpath(noalias file_name: [*:0]const u8, noalias resolved_name: [*]u8) ?[*:0]u8;
114
115pub usingnamespace switch (builtin.os.tag) {
116 .macosx, .ios, .watchos, .tvos => struct {
117 pub const realpath = @"realpath$DARWIN_EXTSN";
118 },
119 else => struct {
120 pub extern "c" fn realpath(noalias file_name: [*:0]const u8, noalias resolved_name: [*]u8) ?[*:0]u8;
121 },
122};
123
115124pub extern "c" fn setreuid(ruid: c_uint, euid: c_uint) c_int;
116125pub extern "c" fn setregid(rgid: c_uint, egid: c_uint) c_int;
117126pub extern "c" fn rmdir(path: [*:0]const u8) c_int;
lib/std/c/darwin.zig+2
......@@ -12,6 +12,8 @@ pub extern "c" fn _dyld_get_image_header(image_index: u32) ?*mach_header;
1212pub extern "c" fn _dyld_get_image_vmaddr_slide(image_index: u32) usize;
1313pub extern "c" fn _dyld_get_image_name(image_index: u32) [*:0]const u8;
1414
15pub extern "c" fn @"realpath$DARWIN_EXTSN"(noalias file_name: [*:0]const u8, noalias resolved_name: [*]u8) ?[*:0]u8;
16
1517pub extern "c" fn __getdirentries64(fd: c_int, buf_ptr: [*]u8, buf_len: usize, basep: *i64) isize;
1618pub extern "c" fn @"fstat$INODE64"(fd: fd_t, buf: *Stat) c_int;
1719