Skip to content

Commit cd4676a

Browse files
committedJun 18, 2018
stage1: update darwin code to workaround old libc bug
See #1128
·
0.15.20.3.0
1 parent 1aa9380 commit cd4676a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎src/os.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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);

0 commit comments

Comments
 (0)
Please sign in to comment.