summaryrefslogtreecommitdiffstats
path: root/debian/patches/upstream_Fix-sort_r-selection-on-GNU-Hurd.patch
blob: 47398cf6736f4c2281a1d679aad709a65bf028b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 3b7ed0e67f919e49ea8b1f5387c14b762f446b45 Mon Sep 17 00:00:00 2001
From: Pino Toscano <toscano.pino@tiscali.it>
Date: Mon, 3 Jul 2023 11:36:47 +0200
Subject: [PATCH] Fix sort_r selection on GNU/Hurd

The Hurd is based on the Mach microkernel, and thus __MACH__ is defined;
since also macOS is (loosely) based on Mach, it defines __MACH__ as
well. Because of this, the wrong variant of sort_r (i.e. the BSD one)
is used for the Hurd, which does not work.

Since on macOS __APPLE__ is defined, and __DARWIN__ helps for older
Mac OS X, then simply drop the __MACH__ selection: the preprocessor
check for the Linux sort_r is properly used for the Hurd (using
__GNU__), and that variant works fine.
---
 src/sort_r.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sort_r.h b/src/sort_r.h
index cfbde7f4..bdc4b2cc 100644
--- a/src/sort_r.h
+++ b/src/sort_r.h
@@ -19,7 +19,7 @@ void sort_r(void *base, size_t nel, size_t width,
             void *arg);
 */
 
-#if (defined __APPLE__ || defined __MACH__ || defined __DARWIN__ || \
+#if (defined __APPLE__ || defined __DARWIN__ || \
      defined __FreeBSD__ || defined __BSD__ || defined __bsdi__ || \
      defined OpenBSD3_1 || defined OpenBSD3_9 || defined __OpenBSD__ || \
      defined __NetBSD__ || \
-- 
2.40.1