]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
netbsd build fix/update. devnexen/sys_shared_update 129/head
authorDavid Carlier <devnexen@gmail.com>
Mon, 21 Feb 2022 12:39:18 +0000 (12:39 +0000)
committerDavid Carlier <devnexen@gmail.com>
Fri, 17 Jun 2022 17:03:40 +0000 (18:03 +0100)
hmac is already defined in this platform.
Sys_FindExecutableName implementation close enough from FreeBSD's

hmac.c
hmac.h
sys_shared.c

diff --git a/hmac.c b/hmac.c
index 8b6d2f6234caa8e612d2710e35daaacc16bd40bb..561e5efcc6179b0720426fe41412f0178b8fe5aa 100644 (file)
--- 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 71108ab65d9a1679d55801cbe7276d851484fe35..2d3f4f052926e88e3541c8073563ac12b12fd0e2 100644 (file)
--- 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
index 39c9bf8bf4e1507d37a0d59b831e078dae5c63a9..c9f9c32fb1699fd1c59ebca5e2edb8d2b8b1af3f 100644 (file)
@@ -18,7 +18,7 @@
 #pragma comment(lib, "winmm.lib")
 #endif
 #else
-# ifdef __FreeBSD__
+# if defined(__FreeBSD__) || defined(__NetBSD__)
 #  include <sys/sysctl.h>
 # endif
 # include <unistd.h>
@@ -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)
        {