summaryrefslogtreecommitdiffstats
path: root/recipes-security/selinux/libsemanage/libsemanage-define-FD_CLOEXEC-as-necessary.patch
blob: 45bcbe6b6e341ea4d0098003baaca370f05a9b77 (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
From 81f2e8b62ad2298a197c4b16e7182a133c1e116f Mon Sep 17 00:00:00 2001
From: Joe MacDonald <joe.macdonald@windriver.com>
Date: Tue, 15 Oct 2013 10:17:38 -0400
Subject: [PATCH] libsemanage: define FD_CLOEXEC as necessary

In truly old systems, even FD_CLOEXEC may not be defined.  Produce a
warning and duplicate the #define for FD_CLOEXEC found in
asm-generic/fcntl.h on more modern platforms.

Upstream-Status: Inappropriate

Signed-off-by: Joe MacDonald <joe.macdonald@windriver.com>
---
 src/semanage_store.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/semanage_store.c b/src/semanage_store.c
index 1a94545..b586a8f 100644
--- a/src/semanage_store.c
+++ b/src/semanage_store.c
@@ -66,6 +66,11 @@ typedef struct dbase_policydb dbase_t;
 
 #define TRUE 1
 
+#ifndef FD_CLOEXEC
+#warning FD_CLOEXEC undefined on this platform, this may leak file descriptors
+#define FD_CLOEXEC 1
+#endif
+
 enum semanage_file_defs {
 	SEMANAGE_ROOT,
 	SEMANAGE_TRANS_LOCK,
-- 
2.7.4