Skip to content

Commit

Permalink
arping / ping: fix couple warnings
Browse files Browse the repository at this point in the history
arping.c:692:33: warning: ISO C forbids empty initializer braces [-Wpedantic]
ping.c:1620:43: warning: ISO C forbids empty initializer braces [-Wpedantic]

Reviewed-by: Petr Vorel <[email protected]>
Signed-off-by: Sami Kerola <[email protected]>
Signed-off-by: Petr Vorel <[email protected]>
  • Loading branch information
kerolasa authored and pevik committed Nov 23, 2019
1 parent 1b5da2d commit 7c4049b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion arping.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,8 @@ static int event_loop(struct run_state *ctl)
uint64_t exp, total_expires = 1;

unsigned char packet[4096];
struct sockaddr_storage from = {};
struct sockaddr_storage from;
memset(&from, 0, sizeof(from));
socklen_t addr_len = sizeof(from);

/* signalfd */
Expand Down
3 changes: 2 additions & 1 deletion ping/ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -1613,11 +1613,12 @@ int ping4_parse_reply(struct ping_rts *rts, struct socket_st *sock,
char *pr_addr(struct ping_rts *rts, void *sa, socklen_t salen)
{
static char buffer[4096] = "";
static struct sockaddr_storage last_sa = {};
static struct sockaddr_storage last_sa;
static socklen_t last_salen = 0;
char name[NI_MAXHOST] = "";
char address[NI_MAXHOST] = "";

memset(&last_sa, 0, sizeof(last_sa));
if (salen == last_salen && !memcmp(sa, &last_sa, salen))
return buffer;

Expand Down

0 comments on commit 7c4049b

Please sign in to comment.