mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-30 18:13:32 +00:00
CLEANUP: protocol: intitialize all of the sockaddr when disconnecting
In issue #894, Coverity suspects uninitialized values for a socket's address whose family is AF_UNSPEC but it doesn't know that the address is not used in this case. It's not on a critical path and working around it is trivial, let's fully declare the address. We're doing it for both TCP and UDP, because the same principle appears at two places.
This commit is contained in:
parent
2e065cbbf6
commit
2f6f362756
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user