mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
addr2line.c (main_exe_path): avoid SEGV when /proc is not available
readlink would return -1 if /proc is not mounted. Coverity Scan found this issue.
This commit is contained in:
parent
47e571c951
commit
db1c30b37f
1 changed files with 1 additions and 0 deletions
|
@ -2050,6 +2050,7 @@ main_exe_path(void)
|
|||
{
|
||||
# define PROC_SELF_EXE "/proc/self/exe"
|
||||
ssize_t len = readlink(PROC_SELF_EXE, binary_filename, PATH_MAX);
|
||||
if (len < 0) return 0;
|
||||
binary_filename[len] = 0;
|
||||
return len;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue