From da99bf09e83469612e2c821696025a4e591bb95c Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 28 Oct 2021 22:28:45 -0700
Subject: [PATCH] utils: Conside musl when wrapping qsort_r

musl now has implemented qsort_r, the signature however matches glibc
and not BSD, current check makes it such that it falls into BSD case
when building for musl, which clearly is wrong, therefore instead of
just checking for glibc check for linux to decide which qsort_r
signature to use. This covers both glibc and musl

Upstream-Status: Pending

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util.c b/src/util.c
index 72426e09..8f29bc5a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -159,7 +159,7 @@ solv_setcloexec(int fd, int state)
 
    see also: http://sources.redhat.com/ml/libc-alpha/2008-12/msg00003.html
  */
-#if (defined(__GLIBC__) || defined(__NEWLIB__)) && (defined(HAVE_QSORT_R) || defined(HAVE___QSORT_R))
+#if (defined(__linux__) || defined(__NEWLIB__)) && (defined(HAVE_QSORT_R) || defined(HAVE___QSORT_R))
 
 void
 solv_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard)
