aboutsummaryrefslogtreecommitdiffstats
path: root/testing/apparmor/0004-parser-provide-typedefs-for-comparison_fn_t-and-__fr.patch
blob: 784fa52c7773b0b36543fc5781c26c33d012a2b1 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From 2e32573574a01681b2b159016e77b0de21e9d70d Mon Sep 17 00:00:00 2001
From: Patrick Steinhardt <ps@pks.im>
Date: Thu, 26 Apr 2018 14:54:05 +0100
Subject: [PATCH 04/11] parser: provide typedefs for comparison_fn_t and
 __free_fn_t

The POSIX standard never defines the typedefs `comparison_fn_t` and
`__free_fn_t`, but they are provided by glibc and user in the parsing
code. Provide the typedefs ourselves to fix compiling on musl based
systems.

(cherry picked from commit 655d3e782661aa756a53b45b2235205f88e1e0d0)

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Acked-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>

PR: https://gitlab.com/apparmor/apparmor/merge_requests/107
---
 parser/parser_alias.c  | 2 ++
 parser/parser_symtab.c | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/parser/parser_alias.c b/parser/parser_alias.c
index f5b6da4e..b96d18f8 100644
--- a/parser/parser_alias.c
+++ b/parser/parser_alias.c
@@ -25,6 +25,8 @@
 #include "parser.h"
 #include "profile.h"
 
+typedef int (*comparison_fn_t)(const void *, const void *);
+
 struct alias_rule {
 	char *from;
 	char *to;
diff --git a/parser/parser_symtab.c b/parser/parser_symtab.c
index 3e667d87..7b8f211b 100644
--- a/parser/parser_symtab.c
+++ b/parser/parser_symtab.c
@@ -25,6 +25,9 @@
 #include "immunix.h"
 #include "parser.h"
 
+typedef int (*comparison_fn_t)(const void *, const void *);
+typedef void (*__free_fn_t)(void *);
+
 enum var_type {
 	sd_boolean,
 	sd_set,
-- 
2.17.1