Commit dc9d7b08 authored by Mark Andrews's avatar Mark Andrews

- Silence benign static analysis warnings.

  [ISC-Bugs #33428]
parent 71334704
......@@ -60,6 +60,9 @@ work on other platforms. Please report any problems and suggested fixes to
Changes since 4.2.5
- Silence benign static analysis warnings.
[ISC-Bugs #33428]
- Add check for 64-bit package for atf.
[ISC-Bugs #32206]
......
......@@ -3,7 +3,7 @@
Parser for dhclient config and lease files... */
/*
* Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
......@@ -241,7 +241,7 @@ int read_client_conf_file (const char *name, struct interface_info *ip,
break;
parse_client_statement (cfile, ip, client);
} while (1);
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
status = (cfile -> warnings_occurred
? DHCP_R_BADPARSE
: ISC_R_SUCCESS);
......@@ -341,7 +341,7 @@ void parse_client_statement (cfile, ip, config)
switch (peek_token (&val, (unsigned *)0, cfile)) {
case INCLUDE:
next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile);
if (token != STRING) {
parse_warn (cfile, "filename string expected.");
......@@ -355,7 +355,7 @@ void parse_client_statement (cfile, ip, config)
return;
case KEY:
next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
if (ip) {
/* This may seem arbitrary, but there's a reason for
doing it: the authentication key database is not
......@@ -378,7 +378,7 @@ void parse_client_statement (cfile, ip, config)
case TOKEN_ALSO:
/* consume ALSO */
next_token(&val, NULL, cfile);
skip_token(&val, NULL, cfile);
/* consume type of ALSO list. */
token = next_token(&val, NULL, cfile);
......@@ -446,7 +446,7 @@ void parse_client_statement (cfile, ip, config)
/* REQUIRE can either start a policy statement or a
comma-separated list of names of required options. */
case REQUIRE:
next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
token = peek_token (&val, (unsigned *)0, cfile);
if (token == AUTHENTICATION) {
policy = P_REQUIRE;
......@@ -456,22 +456,22 @@ void parse_client_statement (cfile, ip, config)
return;
case IGNORE:
next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
policy = P_IGNORE;
goto do_policy;
case ACCEPT:
next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
policy = P_ACCEPT;
goto do_policy;
case PREFER:
next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
policy = P_PREFER;
goto do_policy;
case DONT:
next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
policy = P_DONT;
goto do_policy;
......@@ -504,8 +504,7 @@ void parse_client_statement (cfile, ip, config)
break;
case OPTION:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
token = peek_token (&val, (unsigned *)0, cfile);
if (token == SPACE) {
if (ip) {
......@@ -556,12 +555,12 @@ void parse_client_statement (cfile, ip, config)
return;
case MEDIA:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
parse_string_list (cfile, &config -> media, 1);
return;
case HARDWARE:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
if (ip) {
parse_hardware_param (cfile, &ip -> hw_address);
} else {
......@@ -572,7 +571,7 @@ void parse_client_statement (cfile, ip, config)
return;
case ANYCAST_MAC:
token = next_token(&val, NULL, cfile);
skip_token(&val, NULL, cfile);
if (ip != NULL) {
parse_hardware_param(cfile, &ip->anycast_mac_addr);
} else {
......@@ -583,29 +582,29 @@ void parse_client_statement (cfile, ip, config)
return;
case REQUEST:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
if (config -> requested_options == default_requested_options)
config -> requested_options = NULL;
parse_option_list (cfile, &config -> requested_options);
return;
case TIMEOUT:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
parse_lease_time (cfile, &config -> timeout);
return;
case RETRY:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
parse_lease_time (cfile, &config -> retry_interval);
return;
case SELECT_TIMEOUT:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
parse_lease_time (cfile, &config -> select_interval);
return;
case OMAPI:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile);
if (token != PORT) {
parse_warn (cfile,
......@@ -631,7 +630,7 @@ void parse_client_statement (cfile, ip, config)
return;
case DO_FORWARD_UPDATE:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile);
if (!strcasecmp (val, "on") ||
!strcasecmp (val, "true"))
......@@ -648,32 +647,32 @@ void parse_client_statement (cfile, ip, config)
return;
case REBOOT:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
parse_lease_time (cfile, &config -> reboot_timeout);
return;
case BACKOFF_CUTOFF:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
parse_lease_time (cfile, &config -> backoff_cutoff);
return;
case INITIAL_INTERVAL:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
parse_lease_time (cfile, &config -> initial_interval);
return;
case INITIAL_DELAY:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
parse_lease_time (cfile, &config -> initial_delay);
return;
case SCRIPT:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
parse_string (cfile, &config -> script_name, (unsigned *)0);
return;
case VENDOR:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile);
if (token != OPTION) {
parse_warn (cfile, "expecting 'vendor option space'");
......@@ -708,14 +707,14 @@ void parse_client_statement (cfile, ip, config)
return;
case INTERFACE:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
if (ip)
parse_warn (cfile, "nested interface declaration.");
parse_interface_declaration (cfile, config, (char *)0);
return;
case PSEUDO:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
token = next_token (&val, (unsigned *)0, cfile);
name = dmalloc (strlen (val) + 1, MDL);
if (!name)
......@@ -725,17 +724,17 @@ void parse_client_statement (cfile, ip, config)
return;
case LEASE:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
parse_client_lease_statement (cfile, 1);
return;
case ALIAS:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
parse_client_lease_statement (cfile, 2);
return;
case REJECT:
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
parse_reject_statement (cfile, config);
return;
......@@ -806,7 +805,7 @@ parse_option_list(struct parse *cfile, struct option ***list)
}
if (!is_identifier (token)) {
parse_warn (cfile, "%s: expected option name.", val);
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
skip_to_semi (cfile);
return 0;
}
......@@ -922,7 +921,7 @@ void parse_interface_declaration (cfile, outer_config, name)
break;
parse_client_statement (cfile, ip, client -> config);
} while (1);
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
}
int interface_or_dummy (struct interface_info **pi, const char *name)
......@@ -1049,7 +1048,7 @@ void parse_client_lease_statement (cfile, is_static)
break;
parse_client_lease_declaration (cfile, lease, &ip, &client);
} while (1);
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
/* If the lease declaration didn't include an interface
declaration that we recognized, it's of no use to us. */
......
......@@ -3,7 +3,7 @@
DHCP Client. */
/*
* Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
......@@ -399,7 +399,6 @@ main(int argc, char **argv) {
long temp;
int e;
oldpid = 0;
if ((pidfd = fopen(path_dhclient_pid, "r")) != NULL) {
e = fscanf(pidfd, "%ld\n", &temp);
oldpid = (pid_t)temp;
......@@ -3470,17 +3469,17 @@ void go_daemon ()
else if (pid)
exit (0);
/* Become session leader and get pid... */
pid = setsid ();
(void) setsid ();
/* Close standard I/O descriptors. */
close(0);
close(1);
close(2);
(void) close(0);
(void) close(1);
(void) close(2);
/* Reopen them on /dev/null. */
open("/dev/null", O_RDWR);
open("/dev/null", O_RDWR);
open("/dev/null", O_RDWR);
(void) open("/dev/null", O_RDWR);
(void) open("/dev/null", O_RDWR);
(void) open("/dev/null", O_RDWR);
write_client_pid_file ();
......@@ -4037,6 +4036,7 @@ client_dns_update(struct client_state *client, dhcp_ddns_cb_t *ddns_cb)
* MAC address.
*/
result = 0;
POST(result);
memset(&client_identifier, 0, sizeof(client_identifier));
if (client->active_lease != NULL) {
if (((oc =
......
......@@ -3,7 +3,7 @@
Memory allocation... */
/*
* Copyright (c) 2009,2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2009,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium
*
......@@ -143,7 +143,6 @@ int option_chain_head_dereference (ptr, file, line)
option_cache_dereference ((struct option_cache **)
(&car -> car), MDL);
dfree (car, MDL);
car = cdr;
}
dfree (option_chain_head, file, line);
......
......@@ -3,7 +3,7 @@
Lexical scanner for dhcpd config file... */
/*
* Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
......@@ -534,7 +534,6 @@ static enum dhcp_token read_string (cfile)
goto again;
default:
cfile -> tokbuf [i] = c;
bs = 0;
break;
}
bs = 0;
......
......@@ -3,7 +3,7 @@
Support for executable statements. */
/*
* Copyright (c) 2009,2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2009,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1998-2003 by Internet Software Consortium
*
......@@ -181,6 +181,8 @@ int execute_statements (result, packet, lease, client_state,
#if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: evaluate: %s",
(status ? "succeeded" : "failed"));
#else
POST(status);
#endif
break;
......@@ -272,6 +274,8 @@ int execute_statements (result, packet, lease, client_state,
#if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: return: %s",
(status ? "succeeded" : "failed"));
#else
POST(status);
#endif
break;
......@@ -331,20 +335,20 @@ int execute_statements (result, packet, lease, client_state,
if (!scope) {
log_error("set %s: no scope",
r->data.set.name);
status = 0;
break;
}
if (!*scope) {
if (!binding_scope_allocate(scope, MDL)) {
log_error("set %s: can't allocate scope",
r->data.set.name);
status = 0;
break;
}
}
binding = find_binding(*scope, r->data.set.name);
#if defined (DEBUG_EXPRESSIONS)
log_debug("exec: set %s", r->data.set.name);
#else
POST(status);
#endif
if (binding == NULL) {
binding = dmalloc(sizeof(*binding), MDL);
......@@ -395,14 +399,14 @@ int execute_statements (result, packet, lease, client_state,
#if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: set %s%s", r -> data.set.name,
(binding && status ? "" : " (failed)"));
#else
POST(status);
#endif
break;
case unset_statement:
if (!scope || !*scope) {
status = 0;
if (!scope || !*scope)
break;
}
binding = find_binding (*scope, r -> data.unset);
if (binding) {
if (binding -> value)
......@@ -414,6 +418,8 @@ int execute_statements (result, packet, lease, client_state,
#if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: unset %s: %s", r -> data.unset,
(status ? "found" : "not found"));
#else
POST(status);
#endif
break;
......@@ -463,6 +469,8 @@ int execute_statements (result, packet, lease, client_state,
#if defined (DEBUG_EXPRESSIONS)
log_debug("exec: let %s%s", e->data.let.name,
(binding && status ? "" : "failed"));
#else
POST(status);
#endif
if (!e->data.let.statements) {
} else if (e->data.let.statements->op ==
......@@ -758,11 +766,11 @@ void write_statements (file, statements, indent)
}
if (r -> data.on.evtypes & ON_COMMIT) {
fprintf (file, "%scommit", s);
s = "or";
s = " or ";
}
if (r -> data.on.evtypes & ON_RELEASE) {
fprintf (file, "%srelease", s);
s = "or";
/* s = " or "; */
}
if (r -> data.on.statements) {
fprintf (file, " {");
......@@ -842,7 +850,7 @@ void write_statements (file, statements, indent)
case eval_statement:
indent_spaces (file, indent);
fprintf (file, "eval ");
col = write_expression (file, r -> data.eval,
(void) write_expression (file, r -> data.eval,
indent + 5, indent + 5, 1);
fprintf (file, ";");
break;
......@@ -916,11 +924,11 @@ void write_statements (file, statements, indent)
fprintf (file, "set ");
col = token_print_indent (file, indent + 4, indent + 4,
"", "", r -> data.set.name);
col = token_print_indent (file, col, indent + 4,
(void) token_print_indent (file, col, indent + 4,
" ", " ", "=");
col = write_expression (file, r -> data.set.expr,
indent + 3, indent + 3, 0);
col = token_print_indent (file, col, indent + 4,
(void) token_print_indent (file, col, indent + 4,
" ", "", ";");
break;
......@@ -929,7 +937,7 @@ void write_statements (file, statements, indent)
fprintf (file, "unset ");
col = token_print_indent (file, indent + 6, indent + 6,
"", "", r -> data.set.name);
col = token_print_indent (file, col, indent + 6,
(void) token_print_indent (file, col, indent + 6,
" ", "", ";");
break;
......@@ -940,29 +948,29 @@ void write_statements (file, statements, indent)
"", "", "(");
switch (r -> data.log.priority) {
case log_priority_fatal:
col = token_print_indent
(void) token_print_indent
(file, col, indent + 4, "",
" ", "fatal,");
break;
case log_priority_error:
col = token_print_indent
(void) token_print_indent
(file, col, indent + 4, "",
" ", "error,");
break;
case log_priority_debug:
col = token_print_indent
(void) token_print_indent
(file, col, indent + 4, "",
" ", "debug,");
break;
case log_priority_info:
col = token_print_indent
(void) token_print_indent
(file, col, indent + 4, "",
" ", "info,");
break;
}
col = write_expression (file, r -> data.log.expr,
indent + 4, indent + 4, 0);
col = token_print_indent (file, col, indent + 4,
(void) token_print_indent (file, col, indent + 4,
"", "", ");");
break;
......@@ -979,7 +987,7 @@ void write_statements (file, statements, indent)
col = token_print_indent(file, col, indent + 4, "", " ", ",");
col = write_expression (file, expr->data.arg.val, col, indent + 4, 0);
}
col = token_print_indent(file, col, indent + 4, "", "", ");");
(void) token_print_indent(file, col, indent + 4, "", "", ");");
#else /* !ENABLE_EXECUTE */
log_fatal("Impossible case at %s:%d (ENABLE_EXECUTE "
"is not defined).", MDL);
......
......@@ -4,7 +4,7 @@
responses. */
/*
* Copyright (c) 2011 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2011,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004,2007,2009 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium
*
......@@ -289,17 +289,15 @@ void trace_icmp_input_stop (trace_type_t *ttype) { }
void trace_icmp_output_input (trace_type_t *ttype, unsigned length, char *buf)
{
struct icmp *icmp;
struct iaddr ia;
if (length != (sizeof (*icmp) + (sizeof ia))) {
if (length != (sizeof (struct icmp) + sizeof (ia))) {
log_error ("trace_icmp_output_input: data size mismatch %d:%d",
length, (int)((sizeof (*icmp)) + (sizeof ia)));
length, (int)(sizeof (struct icmp) + sizeof (ia)));
return;
}
ia.len = 4;
memcpy (ia.iabuf, buf, 4);
icmp = (struct icmp *)(buf + 1);
log_error ("trace_icmp_output_input: unsent ping to %s", piaddr (ia));
}
......
......@@ -4,7 +4,7 @@
way... */
/*
* Copyright (c) 2011 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2011,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2007-2009 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004,2005 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
......@@ -198,7 +198,6 @@ addr_match(addr, match)
if (addr->len != match->addr.len)
return 0;
i = 0;
for (i = 0 ; i < addr->len ; i++) {
if ((addr->iabuf[i] & match->mask.iabuf[i]) !=
match->addr.iabuf[i])
......
This diff is collapsed.
......@@ -3,7 +3,7 @@
Turn data structures into printable text. */
/*
* Copyright (c) 2009-2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2009-2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
......@@ -1193,7 +1193,7 @@ int token_print_indent_concat (FILE *file, int col, int indent,
}
va_end (list);
len = token_print_indent (file, col, indent,
col = token_print_indent (file, col, indent,
prefix, suffix, t);
dfree (t, MDL);
return col;
......@@ -1248,7 +1248,7 @@ int token_print_indent (FILE *file, int col, int indent,
{
int len = 0;
if (prefix != NULL)
len = strlen (prefix);
len += strlen (prefix);
if (buf != NULL)
len += strlen (buf);
......
......@@ -3,7 +3,8 @@
Parser for /etc/resolv.conf file. */
/*
* Copyright (c) 2004-2007,2009 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2009,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
......@@ -89,7 +90,6 @@ void read_resolv_conf (parse_time)
(struct domain_search_list *)0;
*dp = nd;
nd -> domain = dn;
dn = (char *)0;
}
nd -> rcdate = parse_time;
token = peek_token (&val,
......@@ -100,7 +100,7 @@ void read_resolv_conf (parse_time)
"junk after domain declaration");
skip_to_semi (cfile);
}
token = next_token (&val, (unsigned *)0, cfile);
skip_token(&val, (unsigned *)0, cfile);
} else if (token == NAMESERVER) {