From 04840c261d8bc6d4d6f0dd233657a0d456155ead Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Fri, 13 Feb 2015 23:25:42 -0500 Subject: [PATCH] Fix some c99 struct initializer uninitialized member warnings that clang detects and GCC misses. --- src/arp.c | 2 +- src/ndhc.c | 3 ++- src/sys.c | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/arp.c b/src/arp.c index db32c64..48447f3 100644 --- a/src/arp.c +++ b/src/arp.c @@ -109,7 +109,7 @@ struct arp_data { static struct arp_data garp = { .state = AS_NONE, .wake_ts = { -1, -1, -1, -1, -1 }, - .send_stats = {{0},{0},{0}}, + .send_stats = {{0,0},{0,0},{0,0}}, .last_conflict_ts = 0, .gw_check_initpings = 0, .arp_check_start_ts = 0, diff --git a/src/ndhc.c b/src/ndhc.c index dc342d8..f63016e 100644 --- a/src/ndhc.c +++ b/src/ndhc.c @@ -186,7 +186,8 @@ static void setup_signals_ndhc(void) static void signal_dispatch(void) { - struct signalfd_siginfo si = {0}; + struct signalfd_siginfo si; + memset(&si, 0, sizeof si); ssize_t r = safe_read(cs.signalFd, (char *)&si, sizeof si); if (r < 0) { log_error("%s: ndhc: error reading from signalfd: %s", diff --git a/src/sys.c b/src/sys.c index 3d6ab9d..728b54a 100644 --- a/src/sys.c +++ b/src/sys.c @@ -77,7 +77,8 @@ int setup_signals_subprocess(void) void signal_dispatch_subprocess(int sfd, const char pname[static 1]) { - struct signalfd_siginfo si = {0}; + struct signalfd_siginfo si; + memset(&si, 0, sizeof si); ssize_t r = safe_read(sfd, (char *)&si, sizeof si); if (r < 0) { log_error("%s: %s: error reading from signalfd: %s",