diff options
| author | Dan Albert <danalbert@google.com> | 2019-09-16 19:26:41 +0000 |
|---|---|---|
| committer | Dan Albert <danalbert@google.com> | 2019-09-16 19:26:41 +0000 |
| commit | a7e9059967c4bff83ae6c3b595828bbbc8aaf82e (patch) | |
| tree | 17f91beff4ecc112991d60aa656e6dfffd57428d /libcxx/include/__config | |
| parent | a507a5ec8f1d7ded4a808a8813be1ade08580a7b (diff) | |
| download | bcm5719-llvm-a7e9059967c4bff83ae6c3b595828bbbc8aaf82e.tar.gz bcm5719-llvm-a7e9059967c4bff83ae6c3b595828bbbc8aaf82e.zip | |
Open fstream files in O_CLOEXEC mode when possible.
Reviewers: EricWF, mclow.lists, ldionne
Reviewed By: ldionne
Subscribers: smeenai, dexonsmith, christof, ldionne, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D59839
llvm-svn: 372027
Diffstat (limited to 'libcxx/include/__config')
| -rw-r--r-- | libcxx/include/__config | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config index bfbedf600f9..17e5e049d6a 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1447,6 +1447,17 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #define _LIBCPP_UNUSED_VAR(x) ((void)(x)) +// Configures the fopen close-on-exec mode character, if any. This string will +// be appended to any mode string used by fstream for fopen/fdopen. +// +// Not all platforms support this, but it helps avoid fd-leaks on platforms that +// do. +#if defined(__BIONIC__) +# define _LIBCPP_FOPEN_CLOEXEC_MODE "e" +#else +# define _LIBCPP_FOPEN_CLOEXEC_MODE +#endif + #endif // __cplusplus #endif // _LIBCPP_CONFIG |

