authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-06-18 12:54:03-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-06-18 12:54:31-04:00
logcd4676a2338430d9e424f297b8b576143c5be180
treea8b424768fc0aa9b787f1363050fb1628f5eb336
parent1aa93808b18e8c54b3227b0039f2821b0e910b27

stage1: update darwin code to workaround old libc bug

See #1128

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

src/os.cpp+3-3
......@@ -994,15 +994,15 @@ int os_self_exe_path(Buf *out_path) {
994994 int ret1 = _NSGetExecutablePath(nullptr, &u32_len);
995995 assert(ret1 != 0);
996996
997 // Make a buffer having room for the temp path.
998997 Buf *tmp = buf_alloc_fixed(u32_len);
999998
1000999 // Fill the executable path.
10011000 int ret2 = _NSGetExecutablePath(buf_ptr(tmp), &u32_len);
10021001 assert(ret2 == 0);
10031002
1004 // Resolve the real path from that.
1005 buf_resize(out_path, PATH_MAX);
1003 // According to libuv project, PATH_MAX*2 works around a libc bug where
1004 // the resolved path is sometimes bigger than PATH_MAX.
1005 buf_resize(out_path, PATH_MAX*2);
10061006 char *real_path = realpath(buf_ptr(tmp), buf_ptr(out_path));
10071007 if (!real_path) {
10081008 buf_init_from_buf(out_path, tmp);