1From 87c782153deb10bd8c3345723a8bcee343826e78 Mon Sep 17 00:00:00 2001
2From: Grimmauld <Grimmauld@grimmauld.de>
3Date: Thu, 10 Jul 2025 18:58:31 +0200
4Subject: [PATCH 1/2] lib/audit_logging.h: fix includes for musl
5
6`sys/types.h` is indirectly included with `glibc`,
7but needs to be specified explicitly on musl.
8---
9 lib/audit_logging.h | 1 +
10 1 file changed, 1 insertion(+)
11
12diff --git a/lib/audit_logging.h b/lib/audit_logging.h
13index 9082a2720..c58861b1e 100644
14--- a/lib/audit_logging.h
15+++ b/lib/audit_logging.h
16@@ -25,6 +25,7 @@
17
18 // Next include is to pick up the function attribute macros
19 #include <features.h>
20+#include <sys/types.h>
21 #include <audit-records.h>
22
23 #ifdef __cplusplus
24
25From 98adfcc4bfa66ac25db0b609d7172d7d40c4f85f Mon Sep 17 00:00:00 2001
26From: Grimmauld <Grimmauld@grimmauld.de>
27Date: Fri, 11 Jul 2025 08:11:21 +0200
28Subject: [PATCH 2/2] Guard __attr_dealloc_free seperately from __attr_dealloc
29
30Otherwise, header include order matters when building against a libc that
31does not itself define __attr_dealloc_free, such as musl.
32---
33 auparse/auparse.h | 2 ++
34 lib/audit_logging.h | 2 ++
35 lib/libaudit.h | 2 ++
36 3 files changed, 6 insertions(+)
37
38diff --git a/auparse/auparse.h b/auparse/auparse.h
39index 48375e2c7..ba5139625 100644
40--- a/auparse/auparse.h
41+++ b/auparse/auparse.h
42@@ -31,6 +31,8 @@
43 #endif
44 #ifndef __attr_dealloc
45 # define __attr_dealloc(dealloc, argno)
46+#endif
47+#ifndef __attr_dealloc_free
48 # define __attr_dealloc_free
49 #endif
50 #ifndef __attribute_malloc__
51diff --git a/lib/audit_logging.h b/lib/audit_logging.h
52index c58861b1e..fab7e75d1 100644
53--- a/lib/audit_logging.h
54+++ b/lib/audit_logging.h
55@@ -40,6 +40,8 @@ extern "C" {
56 #endif
57 #ifndef __attr_dealloc
58 # define __attr_dealloc(dealloc, argno)
59+#endif
60+#ifndef __attr_dealloc_free
61 # define __attr_dealloc_free
62 #endif
63 // Warn unused result
64diff --git a/lib/libaudit.h b/lib/libaudit.h
65index 2c51853b7..cce5dc493 100644
66--- a/lib/libaudit.h
67+++ b/lib/libaudit.h
68@@ -43,6 +43,8 @@
69 // malloc and free assignments
70 #ifndef __attr_dealloc
71 # define __attr_dealloc(dealloc, argno)
72+#endif
73+#ifndef __attr_dealloc_free
74 # define __attr_dealloc_free
75 #endif
76 #ifndef __attribute_malloc__