Reduce the scope of a static variable, and zero-initialize a structure just

to satisfy cppcheck even though it should be safe.
This commit is contained in:
Nicholas J. Kain 2014-03-19 06:00:08 -04:00
parent 597c858f44
commit 861ab28186
3 changed files with 3 additions and 3 deletions

View File

@ -192,7 +192,6 @@ void ifchange_deconfig(struct client_state_t *cs)
static size_t send_client_ip(char *out, size_t olen, struct dhcpmsg *packet)
{
static char snClassC[] = "255.255.255.0";
uint8_t optdata[MAX_DOPT_SIZE], olddata[MAX_DOPT_SIZE];
char ipb[4*INET_ADDRSTRLEN], ip[INET_ADDRSTRLEN], sn[INET_ADDRSTRLEN],
bc[INET_ADDRSTRLEN];
@ -232,6 +231,7 @@ static size_t send_client_ip(char *out, size_t olen, struct dhcpmsg *packet)
return 0;
if (!have_subnet) {
static char snClassC[] = "255.255.255.0";
log_line("Server did not send a subnet mask. Assuming class C (255.255.255.0).");
memcpy(sn, snClassC, sizeof snClassC);
}

View File

@ -268,7 +268,7 @@ static void signal_dispatch(void)
{
int t;
size_t off = 0;
struct signalfd_siginfo si;
struct signalfd_siginfo si = {0};
again:
t = read(signalFd, (char *)&si + off, sizeof si - off);
if (t < 0) {

View File

@ -158,7 +158,7 @@ static void signal_dispatch(void)
{
int t;
size_t off = 0;
struct signalfd_siginfo si;
struct signalfd_siginfo si = {0};
again:
t = read(cs.signalFd, (char *)&si + off, sizeof si - off);
if (t < 0) {