fix: for netbsd ppl.. 6f4b0fce3a (@khorben )

This commit is contained in:
iceman1001 2017-12-13 19:35:52 +01:00
parent 51d1bb2aaa
commit 8d02f4aabc

View file

@ -557,6 +557,7 @@ int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
defined(__FreeBSD_kernel__) || defined(__NetBSD__)
#include <limits.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
@ -574,8 +575,12 @@ int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
for (;;)
{
#ifdef KERN_PROC_ARGV
int mib[4] = { CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV };
#else
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
size_t size = sizeof(buffer1);
#endif
size_t size = sizeof(buffer1);
if (sysctl(mib, (u_int)(sizeof(mib) / sizeof(mib[0])), path, &size, NULL, 0) != 0)
break;