summaryrefslogtreecommitdiffstats
path: root/recipes-security/selinux/libselinux/libselinux-define-FD_CLOEXEC-as-necessary.patch
blob: 1fa1fba31aa550a36bb0e95bdbfc401b2a1d8c15 (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 9a843a025fb0eaad537eb9dce28da539cf2cb9c2 Mon Sep 17 00:00:00 2001
From: Joe MacDonald <joe.macdonald@windriver.com>
Date: Tue, 15 Oct 2013 10:14:41 -0400
Subject: [PATCH 2/3] libselinux: 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.

Uptream-Status: Inappropriate

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

diff --git a/src/setrans_client.c b/src/setrans_client.c
index f9065bd..e07a779 100644
--- a/src/setrans_client.c
+++ b/src/setrans_client.c
@@ -38,6 +38,11 @@ static pthread_key_t destructor_key;
 static int destructor_key_initialized = 0;
 static __thread char destructor_initialized;
 
+#ifndef FD_CLOEXEC
+#warning FD_CLOEXEC undefined on this platform, this may leak file descriptors
+#define FD_CLOEXEC 1
+#endif
+
 /*
  * setransd_open
  *
-- 
1.7.10.4