ProcessLauncherPosixFork: Fetch errno early
I was seeing some unlikely errno values here. I am not sure if this will help, but it nontheless seems like a good idea to stash errno value before issuing other syscalls. llvm-svn: 305778
This commit is contained in:
parent
9a90b68707
commit
6c5c542986
|
@ -52,10 +52,10 @@ static void FixupEnvironment(Args &env) {
|
|||
|
||||
static void LLVM_ATTRIBUTE_NORETURN ExitWithError(int error_fd,
|
||||
const char *operation) {
|
||||
std::ostringstream os;
|
||||
os << operation << " failed: " << strerror(errno);
|
||||
write(error_fd, os.str().data(), os.str().size());
|
||||
close(error_fd);
|
||||
int err = errno;
|
||||
llvm::raw_fd_ostream os(error_fd, true);
|
||||
os << operation << " failed: " << llvm::sys::StrError(err);
|
||||
os.flush();
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue