rely on /proc/self
This commit is contained in:
parent
228d6ff101
commit
d3fa64ce59
|
@ -32,8 +32,7 @@ static void get_exe_filename(char *buf, int sz) {
|
||||||
int len = GetModuleFileName(NULL, buf, sz - 1);
|
int len = GetModuleFileName(NULL, buf, sz - 1);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
char path[512];
|
char path[] = "/proc/self/exe";
|
||||||
sprintf(path, "/proc/%d/exe", getpid());
|
|
||||||
int len = readlink(path, buf, sz - 1);
|
int len = readlink(path, buf, sz - 1);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
|
|
Loading…
Reference in New Issue