diff --git a/src/util/platform/FFPlatform_unix.c b/src/util/platform/FFPlatform_unix.c index 7500261a4..a233c3bc4 100644 --- a/src/util/platform/FFPlatform_unix.c +++ b/src/util/platform/FFPlatform_unix.c @@ -29,11 +29,13 @@ static void getExePath(FFPlatform* platform) (int[]){CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, (int) getpid()}, 4, exePath->chars, &exePathLen, NULL, 0 - )) + ) < 0) exePathLen = 0; + else + exePathLen--; // remove terminating NUL #endif if (exePathLen > 0) - exePath->length = (uint32_t) (exePathLen - 1); + exePath->length = (uint32_t) exePathLen; } static void platformPathAddEnv(FFlist* dirs, const char* env)