aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-security/selinux/libselinux/libselinux-define-FD_CLOEXEC-as-necessary.patch
blob: ad18cf53dd166fc947145bd57b0824d815c0c99e (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
From d0aaf391ab30b253aa22ef6547a039bcac840fc6 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] 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>

---
 src/setrans_client.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/setrans_client.c b/src/setrans_client.c
index fa188a8..a94f02c 100644
--- a/src/setrans_client.c
+++ b/src/setrans_client.c
@@ -39,6 +39,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
  *