Initialize the sockaddr_in and sockaddr_in6 structures

This fixes two scan-build false positives:

context.c:441:23: warning: The left operand of '!=' is a garbage value
                    || sin.sin_port != htons(lwres_udp_port))
                       ~~~~~~~~~~~~ ^
context.c:447:25: warning: The left operand of '!=' is a garbage value
                    || sin6.sin6_port != htons(lwres_udp_port))
                       ~~~~~~~~~~~~~~ ^
2 warnings generated.

The sin and sin6 structures are used as argument to recvfrom call and
they are properly filled by the call.
This commit is contained in:
Ondřej Surý
2019-11-05 11:01:10 +01:00
parent 4e3d0cb7ac
commit 178f2f8426

View File

@@ -402,8 +402,8 @@ lwres_context_recv(lwres_context_t *ctx,
int *recvd_len)
{
LWRES_SOCKADDR_LEN_T fromlen;
struct sockaddr_in sin;
struct sockaddr_in6 sin6;
struct sockaddr_in sin = { .sin_port = 0 };
struct sockaddr_in6 sin6 = { .sin6_port = 0 };
struct sockaddr *sa;
int ret;