mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
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
This commit is contained in:
parent
c7f8ab2cc1
commit
49f2cdbc52
@ -774,8 +774,10 @@ std::error_code openFile(const Twine &Name, int &ResultFD,
|
||||
|
||||
SmallString<128> Storage;
|
||||
StringRef P = Name.toNullTerminatedStringRef(Storage);
|
||||
if ((ResultFD = sys::RetryAfterSignal(-1, ::open, P.begin(), OpenFlags, Mode)) <
|
||||
0)
|
||||
// Call ::open in a lambda to avoid overload resolution in RetryAfterSignal
|
||||
// when open is overloaded, such as in Bionic.
|
||||
auto Open = [&]() { return ::open(P.begin(), OpenFlags, Mode); };
|
||||
if ((ResultFD = sys::RetryAfterSignal(-1, Open)) < 0)
|
||||
return std::error_code(errno, std::generic_category());
|
||||
#ifndef O_CLOEXEC
|
||||
if (!(Flags & OF_ChildInherit)) {
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user