From: David Carlier Date: Mon, 21 Feb 2022 12:39:18 +0000 (+0000) Subject: netbsd build fix/update. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fmerge-requests%2F129%2Fhead;p=xonotic%2Fdarkplaces.git netbsd build fix/update. hmac is already defined in this platform. Sys_FindExecutableName implementation close enough from FreeBSD's --- diff --git a/hmac.c b/hmac.c index 8b6d2f62..561e5efc 100644 --- a/hmac.c +++ b/hmac.c @@ -1,7 +1,7 @@ #include "darkplaces.h" #include "hmac.h" -qbool hmac( +qbool d_hmac( hashfunc_t hfunc, int hlen, int hblock, unsigned char *out, const unsigned char *in, int n, diff --git a/hmac.h b/hmac.h index 71108ab6..2d3f4f05 100644 --- a/hmac.h +++ b/hmac.h @@ -4,14 +4,14 @@ #include "qtypes.h" typedef void (*hashfunc_t) (unsigned char *out, const unsigned char *in, int n); -qbool hmac( +qbool d_hmac( hashfunc_t hfunc, int hlen, int hblock, unsigned char *out, const unsigned char *in, int n, const unsigned char *key, int k ); -#define HMAC_MDFOUR_16BYTES(out, in, n, key, k) hmac(mdfour, 16, 64, out, in, n, key, k) -#define HMAC_SHA256_32BYTES(out, in, n, key, k) hmac(sha256, 32, 64, out, in, n, key, k) +#define HMAC_MDFOUR_16BYTES(out, in, n, key, k) d_hmac(mdfour, 16, 64, out, in, n, key, k) +#define HMAC_SHA256_32BYTES(out, in, n, key, k) d_hmac(sha256, 32, 64, out, in, n, key, k) #endif diff --git a/sys_shared.c b/sys_shared.c index 39c9bf8b..c9f9c32f 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -18,7 +18,7 @@ #pragma comment(lib, "winmm.lib") #endif #else -# ifdef __FreeBSD__ +# if defined(__FreeBSD__) || defined(__NetBSD__) # include # endif # include @@ -552,8 +552,12 @@ static const char *Sys_FindExecutableName(void) #else static char exenamebuf[MAX_OSPATH+1]; ssize_t n = -1; +#if defined(__FreeBSD__) || defined(__NetBSD__) #if defined(__FreeBSD__) int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1}; +#else + int mib[4] = {CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME}; +#endif size_t exenamebuflen = sizeof(exenamebuf)-1; if (sysctl(mib, 4, exenamebuf, &exenamebuflen, NULL, 0) == 0) {