diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 2b5367b36..be9a25a5b 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -769,10 +769,9 @@ static void tcp_disable_listener(struct listener *l) */ static int tcp_suspend_receiver(struct receiver *rx) { - struct sockaddr sa; + const struct sockaddr sa = { .sa_family = AF_UNSPEC }; int ret; - sa.sa_family = AF_UNSPEC; if (connect(rx->fd, &sa, sizeof(sa)) < 0) goto check_already_done; diff --git a/src/proto_udp.c b/src/proto_udp.c index 13545ad58..bebcfb363 100644 --- a/src/proto_udp.c +++ b/src/proto_udp.c @@ -225,14 +225,12 @@ static int udp_suspend_receiver(struct receiver *rx) */ static int udp_resume_receiver(struct receiver *rx) { - struct sockaddr sa; - socklen_t len = sizeof(sa); + const struct sockaddr sa = { .sa_family = AF_UNSPEC }; if (rx->fd < 0) return 0; - sa.sa_family = AF_UNSPEC; - if (connect(rx->fd, &sa, len) < 0) + if (connect(rx->fd, &sa, sizeof(sa)) < 0) return -1; fd_want_recv(rx->fd);