1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

NetBSD build update. (#4079)

This commit is contained in:
David CARLIER 2021-02-02 13:05:19 +00:00 committed by GitHub
parent be1486568a
commit 739f9297c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2021-02-02 22:05:52 +09:00
Merged-By: nurse <naruse@airemix.jp>

View file

@ -2101,11 +2101,15 @@ fail:
* and returns strlen(binary_filename).
* it is NUL terminated.
*/
#if defined(__linux__)
#if defined(__linux__) || defined(__NetBSD__)
static ssize_t
main_exe_path(void)
{
# define PROC_SELF_EXE "/proc/self/exe"
# if defined(__linux__)
# define PROC_SELF_EXE "/proc/self/exe"
# elif defined(__NetBSD__)
# define PROC_SELF_EXE "/proc/curproc/exe"
# endif
ssize_t len = readlink(PROC_SELF_EXE, binary_filename, PATH_MAX);
if (len < 0) return 0;
binary_filename[len] = 0;