[Lldb-commits] [lldb] r305778 - ProcessLauncherPosixFork: Fetch errno early
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 20 01:11:38 PDT 2017
Author: labath
Date: Tue Jun 20 03:11:37 2017
New Revision: 305778
URL: http://llvm.org/viewvc/llvm-project?rev=305778&view=rev
Log:
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.
Modified:
lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp
Modified: lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp?rev=305778&r1=305777&r2=305778&view=diff
==============================================================================
--- lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp (original)
+++ lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp Tue Jun 20 03:11:37 2017
@@ -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);
}
More information about the lldb-commits
mailing list