]> jfr.im git - solanum.git/commitdiff
librb: support rb_path_to_self on FreeBSD 4.8
authorSimon Arlott <sa.me.uk>
Thu, 12 May 2016 11:33:20 +0000 (12:33 +0100)
committerSimon Arlott <sa.me.uk>
Thu, 12 May 2016 11:43:15 +0000 (12:43 +0100)
librb/src/unix.c

index 9cb8451231e349a294ed13359cb1903936ddb886..0fab90a9c26eb2dba138ad3d80c1abb682886748 100644 (file)
@@ -171,7 +171,7 @@ rb_path_to_self(void)
                return NULL;
        realpath(s, 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)
                return path_buf;
        return NULL;
@@ -196,6 +196,8 @@ rb_path_to_self(void)
 
        realpath(tmp_path, path_buf);
        return path_buf;
+#else
+       return NULL;
 #endif
 }