[PATCH] D43698: Plug errno in TCPSocket::Connect()
Kamil Rytarowski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 23 14:49:08 PST 2018
krytarowski created this revision.
krytarowski added reviewers: labath, joerg.
krytarowski added a project: LLDB.
Herald added a subscriber: llvm-commits.
Reset errno to 0 for error branches.
Without this, debugging real issues in LLDB is harder
as we don't know what and when caused the errno
to be set.
Sponsored by <The NetBSD Foundation>
Repository:
rL LLVM
https://reviews.llvm.org/D43698
Files:
source/Host/common/TCPSocket.cpp
Index: source/Host/common/TCPSocket.cpp
===================================================================
--- source/Host/common/TCPSocket.cpp
+++ source/Host/common/TCPSocket.cpp
@@ -146,14 +146,17 @@
host_str.c_str(), NULL, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP);
for (auto address : addresses) {
error = CreateSocket(address.GetFamily());
- if (error.Fail())
+ if (error.Fail()) {
+ errno = 0;
continue;
+ }
address.SetPort(port);
if (-1 == ::connect(GetNativeSocket(), &address.sockaddr(),
address.GetLength())) {
CLOSE_SOCKET(GetNativeSocket());
+ errno = 0;
continue;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43698.135704.patch
Type: text/x-patch
Size: 677 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180223/2d944ee8/attachment.bin>
More information about the llvm-commits
mailing list