aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/helpers.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-06-08 19:49:13 -0700
committerChris Robinson <[email protected]>2018-06-08 19:49:13 -0700
commit73e08e51ba3eb156240c4b240829d85548d25f5a (patch)
tree414bbf329cad5c80fcd33221a6325d1d6eb4f556 /Alc/helpers.c
parentfd1458ce1bfef0d8f8baba0aff5edb5cfa0940a4 (diff)
Properly get the full executable and pathname on FreeBSD
Diffstat (limited to 'Alc/helpers.c')
-rw-r--r--Alc/helpers.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Alc/helpers.c b/Alc/helpers.c
index e54f3fb2..53d85a86 100644
--- a/Alc/helpers.c
+++ b/Alc/helpers.c
@@ -676,13 +676,13 @@ void GetProcBinary(al_string *path, al_string *fname)
size_t pathlen;
#ifdef __FreeBSD__
- int mib[4] = { CTL_KERN, KERN_PROC_ARGS, getpid() };
- if(sysctl(mib, 3, NULL, &pathlen, NULL, 0) == -1)
- WARN("Failed to sysctl kern.procargs.%d: %s\n", mib[2], strerror(errno));
+ int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
+ if(sysctl(mib, 4, NULL, &pathlen, NULL, 0) == -1)
+ WARN("Failed to sysctl kern.proc.pathname: %s\n", strerror(errno));
else
{
pathname = malloc(pathlen + 1);
- sysctl(mib, 3, (void*)pathname, &pathlen, NULL, 0);
+ sysctl(mib, 4, (void*)pathname, &pathlen, NULL, 0);
pathname[pathlen] = 0;
}
#endif