We're currently reporting errno from the clean up call to close(),
which is much less interesting than the failing connect() call that
precedes it. This change reports errno from the connect() call
instead.
Bug:
36249702
Test: Boot bullhead, bionic unit tests
Test: Fake bad end point and see relevant error returned
Change-Id: Icadec463f50cd0a2a2faa08f049a7996cd32786f
socklen_t alen = namelen + offsetof(sockaddr_un, sun_path) + 1;
if (TEMP_FAILURE_RETRY(connect(socket_, reinterpret_cast<sockaddr*>(&addr), alen)) == -1) {
+ last_error_ = errno;
close(socket_);
socket_ = -1;
- last_error_ = errno;
}
}