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); } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits