Skip to content

Commit

Permalink
Fix build on FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Sep 25, 2023
1 parent 766b06d commit cbb3833
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions addr2line.c
Expand Up @@ -2504,15 +2504,15 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
#if defined(__FreeBSD__) || defined(__DragonFly__)
# include <sys/sysctl.h>
#endif
/* ssize_t main_exe_path(void)
/* ssize_t main_exe_path(FILE *errout)
*
* store the path of the main executable to `binary_filename`,
* and returns strlen(binary_filename).
* it is NUL terminated.
*/
#if defined(__linux__) || defined(__NetBSD__)
static ssize_t
main_exe_path(void)
main_exe_path(FILE *errout)
{
# if defined(__linux__)
# define PROC_SELF_EXE "/proc/self/exe"
Expand All @@ -2526,7 +2526,7 @@ main_exe_path(void)
}
#elif defined(__FreeBSD__) || defined(__DragonFly__)
static ssize_t
main_exe_path(void)
main_exe_path(FILE *errout)
{
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
size_t len = PATH_MAX;
Expand All @@ -2540,7 +2540,7 @@ main_exe_path(void)
}
#elif defined(HAVE_LIBPROC_H)
static ssize_t
main_exe_path(void)
main_exe_path(FILE *errout)
{
int len = proc_pidpath(getpid(), binary_filename, PATH_MAX);
if (len == 0) return 0;
Expand Down Expand Up @@ -2614,7 +2614,7 @@ rb_dump_backtrace_with_lines(int num_traces, void **traces, FILE *errout)
#ifdef HAVE_MAIN_EXE_PATH
char *main_path = NULL; /* used on printing backtrace */
ssize_t len;
if ((len = main_exe_path()) > 0) {
if ((len = main_exe_path(errout)) > 0) {
main_path = (char *)alloca(len + 1);
if (main_path) {
uintptr_t addr;
Expand Down

0 comments on commit cbb3833

Please sign in to comment.