diff options
Diffstat (limited to 'source/Host/freebsd/Host.cpp')
-rw-r--r-- | source/Host/freebsd/Host.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/Host/freebsd/Host.cpp b/source/Host/freebsd/Host.cpp index 037dfc7f5e033..124a8a760133a 100644 --- a/source/Host/freebsd/Host.cpp +++ b/source/Host/freebsd/Host.cpp @@ -73,7 +73,14 @@ GetFreeBSDProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr, if (!cstr) return false; - process_info.GetExecutableFile().SetFile(cstr, false); + // Get pathname for pid. If that fails fall back to argv[0]. + char pathname[MAXPATHLEN]; + size_t pathname_len = sizeof(pathname); + mib[2] = KERN_PROC_PATHNAME; + if (::sysctl(mib, 4, pathname, &pathname_len, NULL, 0) == 0) + process_info.GetExecutableFile().SetFile(pathname, false); + else + process_info.GetExecutableFile().SetFile(cstr, false); if (!(match_info_ptr == NULL || NameMatches(process_info.GetExecutableFile().GetFilename().GetCString(), |