Merge pull request #615 from Jan200101/PR/proc-self

rely on /proc/self
This commit is contained in:
Francesco 2021-10-12 12:16:43 +02:00 committed by GitHub
commit e99d0e51c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -32,8 +32,7 @@ static void get_exe_filename(char *buf, int sz) {
int len = GetModuleFileName(NULL, buf, sz - 1);
buf[len] = '\0';
#elif __linux__
char path[512];
sprintf(path, "/proc/%d/exe", getpid());
char path[] = "/proc/self/exe";
int len = readlink(path, buf, sz - 1);
buf[len] = '\0';
#elif __APPLE__