summaryrefslogtreecommitdiff
blob: c7a4c1034c90dc638dd13055b08a403cc91a28c8 (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
sent upstream

From 1f15000ad21c301a51f7746eb561659348060f45 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@chromium.org>
Date: Wed, 25 Jan 2017 14:06:55 -1000
Subject: [PATCH keyutils] add extern C markings to header file for C++ users

If people try to use keyutils from C++ code, the header doesn't work
properly because the compiler mangles the keyutils symbols.  Add the
right extern markings so it works out of the box.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 keyutils.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/keyutils.h b/keyutils.h
index a69fa7aaa11d..d50d19d3e929 100644
--- a/keyutils.h
+++ b/keyutils.h
@@ -15,6 +15,10 @@
 #include <sys/types.h>
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern const char keyutils_version_string[];
 extern const char keyutils_build_string[];
 
@@ -180,4 +184,8 @@ extern int recursive_session_key_scan(recursive_key_scanner_t func, void *data);
 extern key_serial_t find_key_by_type_and_desc(const char *type, const char *desc,
 					      key_serial_t destringid);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* KEYUTILS_H */
-- 
2.11.0