aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2024-03-19 01:42:58 +0000
committerElliott Hughes <enh@google.com>2024-03-19 01:42:58 +0000
commit6929e4e5dcb158f4538fa1a0b91b1ad925cef9cb (patch)
tree08aa4f2796fec5695a1bbfc73744622ce9d4df74
parentb70699b8e420de801e9b815e3433797d60da8302 (diff)
downloadrecovery-6929e4e5dcb158f4538fa1a0b91b1ad925cef9cb.tar.gz
Fix connect() retry loop.
This would succeed eventually anyway: the first time round the connect() succeeds, returns 0, and we go around the loop again; the second time the connect() fails (because we're already connected), returns -1, and we set success to true and exit the loop. But this means that the intended retry functionality is broken. Change-Id: If631d59e23b12e9aa952cdb528160b19b9a94b1c
-rw-r--r--tests/unit/uncrypt_test.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/unit/uncrypt_test.cpp b/tests/unit/uncrypt_test.cpp
index e97d589a..88fd16a2 100644
--- a/tests/unit/uncrypt_test.cpp
+++ b/tests/unit/uncrypt_test.cpp
@@ -96,7 +96,7 @@ class UncryptTest : public ::testing::Test {
// Connect to the uncrypt socket.
bool success = false;
for (int retry = 0; retry < SOCKET_CONNECTION_MAX_RETRY; retry++) {
- if (connect(sockfd, reinterpret_cast<sockaddr*>(&un), sizeof(sockaddr_un)) != 0) {
+ if (connect(sockfd, reinterpret_cast<sockaddr*>(&un), sizeof(sockaddr_un)) == 0) {
success = true;
break;
}