diff options
Diffstat (limited to 'cwd.patch')
-rw-r--r-- | cwd.patch | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/cwd.patch b/cwd.patch new file mode 100644 index 000000000000..e9191ba49880 --- /dev/null +++ b/cwd.patch @@ -0,0 +1,30 @@ +--- utils.cpp 2017-09-16 18:05:05.050328507 +0000 ++++ utils.cpp 2017-09-16 18:22:49.796658537 +0000 +@@ -271,6 +271,7 @@ + char* get_runtime_path() { + static char path[PATH_MAX]; + static byte query = 1; ++ int len; + + #ifdef __APPLE__ + strcpy(path, "./"); +@@ -278,15 +279,12 @@ + #endif + + if(query) { +- if(readlink("/proc/self/exe", path, PATH_MAX ) <= 0) { ++ len = readlink("/proc/self/cwd", path, PATH_MAX); ++ if (len <= 0) { + return NULL; + } +- char* path_end = strrchr(path, '/'); +- if(path_end == NULL) { +- return NULL; +- } +- path_end++; +- *path_end=0; ++ path[len] = '/'; ++ path[len+1] = '\0'; + query = 0; + } + return path; |