*: add/cleanup initialisers
There were some (inconsequential) warnings about uninitialised use of
variables. Also, in one case, sub-structs were mixed in initialisation,
which doesn't quite work as intended.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index be3c2ee..95f1dff 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -131,7 +131,7 @@
void *object)
{
union sockunion *su;
- union sockunion su_def = { .sa.sa_family = AF_INET,
+ union sockunion su_def = { .sin.sin_family = AF_INET,
.sin.sin_addr.s_addr = INADDR_ANY };
struct peer_group *group;
struct peer *peer;
diff --git a/lib/command.c b/lib/command.c
index 8317789..f20065f 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1353,7 +1353,7 @@
enum match_type multiple_match;
unsigned int multiple_index;
const char *word;
- const char *arg;
+ const char *arg = NULL;
struct cmd_token *word_token;
enum match_type word_match;
diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c
index 6205b3e..58a3992 100644
--- a/ospfd/ospf_spf.c
+++ b/ospfd/ospf_spf.c
@@ -590,7 +590,7 @@
if (l->m[0].type == LSA_LINK_TYPE_POINTOPOINT)
{
- struct in_addr nexthop;
+ struct in_addr nexthop = { .s_addr = 0 };
/* If the destination is a router which connects to
the calculating router via a Point-to-MultiPoint
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index 8c20a7a..82e3818 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -236,7 +236,7 @@
struct msghdr msg;
struct iovec iov;
struct cmsghdr *cmsgptr;
- struct in6_addr dst;
+ struct in6_addr dst = { .s6_addr = { 0 } };
/* Ancillary data. This store cmsghdr and in6_pktinfo. But at this
point I can't determine size of cmsghdr */