We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1408f15 commit e6b72e8Copy full SHA for e6b72e8
addr2line.c
@@ -21,6 +21,10 @@
21
#include <stdio.h>
22
#include <errno.h>
23
24
+#ifdef HAVE_LIBPROC_H
25
+#include <libproc.h>
26
+#endif
27
+
28
#ifdef HAVE_STDBOOL_H
29
#include <stdbool.h>
30
#else
@@ -2068,6 +2072,15 @@ main_exe_path(void)
2068
2072
len--; /* sysctl sets strlen+1 */
2069
2073
return len;
2070
2074
}
2075
+#elif defined(HAVE_LIBPROC_H)
2076
+static ssize_t
2077
+main_exe_path(void)
2078
+{
2079
+ int len = proc_pidpath(getpid(), binary_filename, PATH_MAX);
2080
+ if (len == 0) return 0;
2081
+ binary_filename[len] = 0;
2082
+ return len;
2083
+}
2071
2084
2085
#undef HAVE_MAIN_EXE_PATH
2086
#endif
0 commit comments