librb: support rb_path_to_self on FreeBSD 4.8

This commit is contained in:
Simon Arlott 2016-05-12 12:33:20 +01:00
parent d2a4981ab2
commit 87f7632760
No known key found for this signature in database
GPG key ID: C8975F2043CA5D24

View file

@ -171,7 +171,7 @@ rb_path_to_self(void)
return NULL; return NULL;
realpath(s, path_buf); realpath(s, path_buf);
return path_buf; return path_buf;
#elif defined(__linux__) #elif defined(__linux__) || (defined(__FreeBSD__) && !defined(KERN_PROC_PATHNAME))
if (readlink("/proc/self/exe", path_buf, path_len) != -1) if (readlink("/proc/self/exe", path_buf, path_len) != -1)
return path_buf; return path_buf;
return NULL; return NULL;
@ -196,6 +196,8 @@ rb_path_to_self(void)
realpath(tmp_path, path_buf); realpath(tmp_path, path_buf);
return path_buf; return path_buf;
#else
return NULL;
#endif #endif
} }