Skip to content

Commit

Permalink
Fix sock_connect()
Browse files Browse the repository at this point in the history
`rc` must be reset in order to make the `do-while` loop work in case
there's no `sockopt_cb` set.

Fixup of f346046

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
  • Loading branch information
sjaeckel committed Feb 14, 2024
1 parent 641211e commit 5edc480
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ sock_t sock_connect(xmpp_sock_t *xsock)
{
struct addrinfo *ainfo;
sock_t sock;
int rc = 0;
int rc;
char buf[64];

do {
Expand All @@ -228,6 +228,7 @@ sock_t sock_connect(xmpp_sock_t *xsock)

sock = socket(ainfo->ai_family, ainfo->ai_socktype, ainfo->ai_protocol);
if (sock != INVALID_SOCKET) {
rc = 0;
if (xsock->conn->sockopt_cb) {
/* Don't allow user to overwrite sockfd value. */
sock_t sock_copy = sock;
Expand Down

0 comments on commit 5edc480

Please sign in to comment.