From 9a843a025fb0eaad537eb9dce28da539cf2cb9c2 Mon Sep 17 00:00:00 2001 From: Joe MacDonald 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 --- 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