aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-01-13 03:38:10 -0800
committerChris Robinson <[email protected]>2018-01-13 03:38:10 -0800
commit71ad3b17153e7cbf25c3c6c1fb04fedabf596ff6 (patch)
tree7e5d36418954190eea54ec4f3ce1722785c94d0a /Alc
parentaf8bbefcab1d7ff68dc9c9ce7bc0a0deffe39845 (diff)
Use KERN_PROCARGS to get the process path+filename on FreeBSD
Diffstat (limited to 'Alc')
-rw-r--r--Alc/helpers.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/Alc/helpers.c b/Alc/helpers.c
index 2aded6c5..790484e9 100644
--- a/Alc/helpers.c
+++ b/Alc/helpers.c
@@ -735,14 +735,13 @@ void GetProcBinary(al_string *path, al_string *fname)
size_t pathlen;
#ifdef __FreeBSD__
- int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
- mib[3] = getpid();
- if(sysctl(mib, 4, NULL, &pathlen, NULL, 0) == -1)
- WARN("Failed to sysctl kern.proc.pathname.%d: %s\n", mib[3], strerror(errno));
+ int mib[4] = { CTL_KERN, KERN_PROCARGS, getpid() };
+ if(sysctl(mib, 3, NULL, &pathlen, NULL, 0) == -1)
+ WARN("Failed to sysctl kern.procargs.%d: %s\n", mib[2], strerror(errno));
else
{
pathname = malloc(pathlen + 1);
- sysctl(mib, 4, (void*)pathname, &pathlen, NULL, 0);
+ sysctl(mib, 3, (void*)pathname, &pathlen, NULL, 0);
pathname[pathlen] = 0;
}
#endif