git: a7c48b30a0ac - main - security/hashcat: unbreak on -CURRENT after GNU qsort_r

From: Xin LI <delphij_at_FreeBSD.org>
Date: Fri, 30 Sep 2022 22:29:58 UTC
The branch main has been updated by delphij:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a7c48b30a0ac7dac2ecf8d4dc3acdf5c5c02c452

commit a7c48b30a0ac7dac2ecf8d4dc3acdf5c5c02c452
Author:     Xin LI <delphij@FreeBSD.org>
AuthorDate: 2022-09-30 20:34:40 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2022-09-30 22:28:04 +0000

    security/hashcat: unbreak on -CURRENT after GNU qsort_r
    
    PR:             ports/266227
    Exp-run by:     antoine
    Approved by:    portmgr
---
 security/hashcat/files/patch-include_sort__r.h | 33 ++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/security/hashcat/files/patch-include_sort__r.h b/security/hashcat/files/patch-include_sort__r.h
new file mode 100644
index 000000000000..3e1d0e0d9d33
--- /dev/null
+++ b/security/hashcat/files/patch-include_sort__r.h
@@ -0,0 +1,33 @@
+--- include/sort_r.h.orig	2022-09-02 14:58:13 UTC
++++ include/sort_r.h
+@@ -25,10 +25,10 @@ Slightly modified to work with hashcat to no falsly de
+ */
+ 
+ #if (defined __APPLE__ || defined __MACH__ || defined __DARWIN__ || \
+-     defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__)
++     (defined __FreeBSD__ && !defined(qsort_r)) || defined __DragonFly__ || defined __NetBSD__)
+ #  define _SORT_R_BSD
+ #  define _SORT_R_INLINE inline
+-#elif (defined __linux__) || defined (__CYGWIN__)
++#elif (defined __linux__) || defined (__CYGWIN__) || (defined (__FreeBSD__) && defined(qsort_r))
+ #  define _SORT_R_LINUX
+ #  define _SORT_R_INLINE inline
+ #elif (defined _WIN32 || defined _WIN64 || defined __WINDOWS__)
+@@ -167,7 +167,7 @@ static _SORT_R_INLINE void sort_r_simple(void *base, s
+   #if defined _SORT_R_LINUX
+ 
+     typedef int(* __compar_d_fn_t)(const void *, const void *, void *);
+-    extern void qsort_r(void *base, size_t nel, size_t width,
++    extern void (qsort_r)(void *base, size_t nel, size_t width,
+                         __compar_d_fn_t __compar, void *arg)
+       __attribute__((nonnull (1, 4)));
+ 
+@@ -186,7 +186,7 @@ static _SORT_R_INLINE void sort_r_simple(void *base, s
+         /* no qsort_r in glibc before 2.8, need to use nested qsort */
+         sort_r_simple(base, nel, width, compar, arg);
+ 
+-      #elif defined __GLIBC__
++      #elif defined __GLIBC__ || (defined(__FreeBSD__) && defined(qsort_r))
+ 
+         qsort_r(base, nel, width, compar, arg);
+