From 8d02f4aabc66b12cab81c87eed7d4c7b90abf983 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 13 Dec 2017 19:35:52 +0100 Subject: [PATCH] fix: for netbsd ppl.. https://github.com/DeforaNetworks/proxmark3/commit/6f4b0fce3a10e5ae65d3dcb2c29cca76741ab818 (@khorben ) --- client/whereami.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/whereami.c b/client/whereami.c index 7cb045a6c..acf3ff2e8 100644 --- a/client/whereami.c +++ b/client/whereami.c @@ -557,6 +557,7 @@ int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length) defined(__FreeBSD_kernel__) || defined(__NetBSD__) #include +#include #include #include #include @@ -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;