]> granicus.if.org Git - llvm/commit
[Support] Use O_CLOEXEC only when declared
authorPavel Labath <labath@google.com>
Tue, 24 Jan 2017 10:57:01 +0000 (10:57 +0000)
committerPavel Labath <labath@google.com>
Tue, 24 Jan 2017 10:57:01 +0000 (10:57 +0000)
commitc5e1c4de455f079fa8e25122db59c3135a60ebb3
tree74d3718f0c4631fe99182d2a26c69c6d86961845
parente414b998793775209f746bce6d0716fec6593fbc
[Support] Use O_CLOEXEC only when declared

Summary:
Use the O_CLOEXEC flag only when it is available. Some old systems (e.g.
SLES10) do not support this flag. POSIX explicitly guarantees that this
flag can be checked for using #if, so there is no need for a CMake
check.

In case O_CLOEXEC is not supported, fall back to fcntl(FD_CLOEXEC)
instead.

Reviewers: rnk, rafael, mgorny

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D28894

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292912 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Support/Unix/Path.inc