ports/math/lean/files/patch-util_path.cpp
2018-07-22 05:58:39 +00:00

14 lines
482 B
C++

--- util/path.cpp.orig 2018-07-22 05:22:25 UTC
+++ util/path.cpp
@@ -82,7 +82,11 @@ std::string get_exe_location() {
char dest[PATH_MAX];
memset(dest, 0, PATH_MAX);
pid_t pid = getpid();
+#if defined(__FreeBSD__)
+ snprintf(path, PATH_MAX, "/proc/%d/file", pid);
+#else
snprintf(path, PATH_MAX, "/proc/%d/exe", pid);
+#endif
if (readlink(path, dest, PATH_MAX) == -1) {
throw exception("failed to locate Lean executable location");
} else {