diff options
author | Hans Wennborg <hans@hanshq.net> | 2018-08-27 15:55:39 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2018-08-27 15:55:39 +0000 |
commit | 0a0e411204a2baa520fd73a8d69b664f98b428ba (patch) | |
tree | 4457df74f92b87517abddb0b1682401d937900b9 /llvm/lib/Support/Unix/Process.inc | |
parent | 8a9cb242fb1a5fef9103a6df15d601ede83dba0b (diff) | |
download | bcm5719-llvm-0a0e411204a2baa520fd73a8d69b664f98b428ba.tar.gz bcm5719-llvm-0a0e411204a2baa520fd73a8d69b664f98b428ba.zip |
Use a lambda for calls to ::open in RetryAfterSignal
In Bionic, open can be overloaded for _FORTIFY_SOURCE support, causing
compile errors of RetryAfterSignal due to overload resolution. Wrapping
the call in a lambda avoids this.
Based on a patch by Chih-Wei Huang <cwhuang@linux.org.tw>!
llvm-svn: 340751
Diffstat (limited to 'llvm/lib/Support/Unix/Process.inc')
-rw-r--r-- | llvm/lib/Support/Unix/Process.inc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Support/Unix/Process.inc b/llvm/lib/Support/Unix/Process.inc index fa515d44f3f..3185f45a3a6 100644 --- a/llvm/lib/Support/Unix/Process.inc +++ b/llvm/lib/Support/Unix/Process.inc @@ -211,7 +211,10 @@ std::error_code Process::FixupStandardFileDescriptors() { assert(errno == EBADF && "expected errno to have EBADF at this point!"); if (NullFD < 0) { - if ((NullFD = RetryAfterSignal(-1, ::open, "/dev/null", O_RDWR)) < 0) + // Call ::open in a lambda to avoid overload resolution in + // RetryAfterSignal when open is overloaded, such as in Bionic. + auto Open = [&]() { return ::open("/dev/null", O_RDWR); }; + if ((NullFD = RetryAfterSignal(-1, Open)) < 0) return std::error_code(errno, std::generic_category()); } |