summaryrefslogtreecommitdiffstats
path: root/include/c.h
diff options
context:
space:
mode:
authorKarel Zak2013-04-03 16:11:19 +0200
committerKarel Zak2013-04-03 16:11:19 +0200
commit2ffad204c0c78009a497b093f9c9bbc148c6ed9a (patch)
tree3a82def3d5b361e3223a9ed8bdfbdd4f6a168b45 /include/c.h
parentlib/canonicalize: don't use /dev/mapper/<name> if the node does not exist (diff)
downloadkernel-qcow2-util-linux-2ffad204c0c78009a497b093f9c9bbc148c6ed9a.tar.gz
kernel-qcow2-util-linux-2ffad204c0c78009a497b093f9c9bbc148c6ed9a.tar.xz
kernel-qcow2-util-linux-2ffad204c0c78009a497b093f9c9bbc148c6ed9a.zip
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>
Diffstat (limited to 'include/c.h')
-rw-r--r--include/c.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/c.h b/include/c.h
index d2d68c31d..a50e8a593 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