blob: 2ea9fd1d73cb95361586d71c29ac09af2f9c0acc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
--- 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 {
|