aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2013-04-03 16:11:19 +0200
committerKarel Zak <kzak@redhat.com>2013-04-03 16:11:19 +0200
commit2ffad204c0c78009a497b093f9c9bbc148c6ed9a (patch)
tree3a82def3d5b361e3223a9ed8bdfbdd4f6a168b45
parent4e5262e450a7ca2835d6c64edef8df0ad24f75a9 (diff)
downloadutil-linux-2ffad204c0c78009a497b093f9c9bbc148c6ed9a.tar.gz
include/c: add macro UL_CLOEXECSTR
... to make "e" for fopen() portable to systems without O_CLOEXEC. Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--include/c.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/c.h b/include/c.h
index d2d68c31df..a50e8a5933 100644
--- a/include/c.h
+++ b/include/c.h
@@ -215,10 +215,18 @@ static inline int dirfd(DIR *d)
* Fallback defines for old versions of glibc
*/
#include <fcntl.h>
+
+#ifdef O_CLOEXEC
+#define UL_CLOEXECSTR "e"
+#else
+#define UL_CLOEXECSTR ""
+#endif
+
#ifndef O_CLOEXEC
#define O_CLOEXEC 0
#endif
+
#ifndef AI_ADDRCONFIG
#define AI_ADDRCONFIG 0x0020
#endif