- made lint clean.

git-svn-id: file:///svn/unbound/trunk@3050 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2014-01-24 13:23:45 +00:00
parent 60511959ab
commit 361cc1f511
10 changed files with 32 additions and 26 deletions

View file

@ -255,7 +255,7 @@ daemon_open_shared_ports(struct daemon* daemon)
{
log_assert(daemon);
if(daemon->cfg->port != daemon->listening_port) {
int i;
size_t i;
#if defined(__linux__) && defined(SO_REUSEPORT)
if(daemon->cfg->so_reuseport && daemon->cfg->num_threads > 0)
daemon->num_ports = daemon->cfg->num_threads;
@ -568,7 +568,7 @@ daemon_cleanup(struct daemon* daemon)
void
daemon_delete(struct daemon* daemon)
{
int i;
size_t i;
if(!daemon)
return;
modstack_desetup(&daemon->mods, daemon->env);

View file

@ -76,7 +76,7 @@ struct daemon {
* or just one element[0] shared by the worker threads. */
struct listen_port** ports;
/** size of ports array */
int num_ports;
size_t num_ports;
/** port number for remote that has ports opened. */
int rc_port;
/** listening ports for remote control */

View file

@ -66,9 +66,12 @@
#include <grp.h>
#endif
#ifndef S_SPLINT_S
/* splint chokes on this system header file */
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#endif /* S_SPLINT_S */
#ifdef HAVE_LOGIN_CAP_H
#include <login_cap.h>
#endif
@ -192,6 +195,7 @@ int replay_var_compare(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
static void
checkrlimits(struct config_file* cfg)
{
#ifndef S_SPLINT_S
#ifdef HAVE_GETRLIMIT
/* list has number of ports to listen to, ifs number addresses */
int list = ((cfg->do_udp?1:0) + (cfg->do_tcp?1 +
@ -282,6 +286,7 @@ checkrlimits(struct config_file* cfg)
#else
(void)cfg;
#endif /* HAVE_GETRLIMIT */
#endif /* S_SPLINT_S */
}
/** set verbosity, check rlimits, cache settings */

View file

@ -6,6 +6,7 @@
lock contention on localzones.lock. It is changed to an rwlock.
- so-reuseport: yesno option to distribute queries evenly over
threads on Linux (Thanks Robert Edmonds).
- made lint clean.
21 January 2014: Wouter
- Fix #547: no trustanchor written if filesystem full, fclose checked.

View file

@ -76,7 +76,7 @@ verbose_print_addr(struct addrinfo *addr)
#endif /* INET6 */
if(inet_ntop(addr->ai_family, sinaddr, buf,
(socklen_t)sizeof(buf)) == 0) {
strlcpy(buf, "(null)", sizeof(buf));
(void)strlcpy(buf, "(null)", sizeof(buf));
}
buf[sizeof(buf)-1] = 0;
verbose(VERB_ALGO, "creating %s%s socket %s %d",
@ -617,9 +617,9 @@ make_sock_port(int stype, const char* ifname, const char* port,
*noip6 = 0;
return -1;
}
strlcpy(newif, ifname, sizeof(newif));
(void)strlcpy(newif, ifname, sizeof(newif));
newif[s-ifname] = 0;
strlcpy(p, s+1, sizeof(p));
(void)strlcpy(p, s+1, sizeof(p));
p[strlen(s+1)]=0;
return make_sock(stype, newif, p, hints, v6only, noip6,
rcv, snd, reuseport);

View file

@ -344,9 +344,9 @@ morechecks(struct config_file* cfg, const char* fname)
if(fname[0] != '/') {
if(getcwd(buf, sizeof(buf)) == NULL)
fatal_exit("getcwd: %s", strerror(errno));
strlcat(buf, "/", sizeof(buf));
(void)strlcat(buf, "/", sizeof(buf));
}
strlcat(buf, fname, sizeof(buf));
(void)strlcat(buf, fname, sizeof(buf));
if(strncmp(buf, cfg->chrootdir, strlen(cfg->chrootdir)) != 0)
fatal_exit("config file %s is not inside chroot %s",
buf, cfg->chrootdir);

View file

@ -890,12 +890,12 @@ proxy_list_clear(struct proxy* p)
if(inet_ntop(AF_INET6,
&((struct sockaddr_in6*)&p->addr)->sin6_addr,
from, (socklen_t)sizeof(from)) == 0)
strlcpy(from, "err", sizeof(from));
(void)strlcpy(from, "err", sizeof(from));
} else {
if(inet_ntop(AF_INET,
&((struct sockaddr_in*)&p->addr)->sin_addr,
from, (socklen_t)sizeof(from)) == 0)
strlcpy(from, "err", sizeof(from));
(void)strlcpy(from, "err", sizeof(from));
}
printf("client[%d]: last %s@%d of %d : %u in, %u out, "
"%u returned\n", i++, from, port, (int)p->numreuse+1,

View file

@ -1250,14 +1250,14 @@ fname_after_chroot(const char* fname, struct config_file* cfg, int use_chdir)
if(cfg->chrootdir && cfg->chrootdir[0] &&
strncmp(cfg->chrootdir, fname, strlen(cfg->chrootdir)) == 0) {
/* already full pathname, return it */
strlcpy(buf, fname, len);
(void)strlcpy(buf, fname, len);
buf[len-1] = 0;
return buf;
}
/* chroot */
if(cfg->chrootdir && cfg->chrootdir[0]) {
/* start with chrootdir */
strlcpy(buf, cfg->chrootdir, len);
(void)strlcpy(buf, cfg->chrootdir, len);
slashit = 1;
}
#ifdef UB_ON_WINDOWS
@ -1271,20 +1271,20 @@ fname_after_chroot(const char* fname, struct config_file* cfg, int use_chdir)
} else if(cfg->directory && cfg->directory[0]) {
/* prepend chdir */
if(slashit && cfg->directory[0] != '/')
strlcat(buf, "/", len);
(void)strlcat(buf, "/", len);
/* is the directory already in the chroot? */
if(cfg->chrootdir && cfg->chrootdir[0] &&
strncmp(cfg->chrootdir, cfg->directory,
strlen(cfg->chrootdir)) == 0)
strlcat(buf, cfg->directory+strlen(cfg->chrootdir),
(void)strlcat(buf, cfg->directory+strlen(cfg->chrootdir),
len);
else strlcat(buf, cfg->directory, len);
else (void)strlcat(buf, cfg->directory, len);
slashit = 1;
}
/* fname */
if(slashit && fname[0] != '/')
strlcat(buf, "/", len);
strlcat(buf, fname, len);
(void)strlcat(buf, "/", len);
(void)strlcat(buf, fname, len);
buf[len-1] = 0;
return buf;
}
@ -1336,7 +1336,7 @@ cfg_parse_local_zone(struct config_file* cfg, const char* val)
log_err("syntax error: bad zone name: %s", val);
return 0;
}
strlcpy(buf, name, sizeof(buf));
(void)strlcpy(buf, name, sizeof(buf));
buf[name_end-name] = '\0';
type = last_space_pos(name_end);

View file

@ -160,7 +160,7 @@ log_addr(enum verbosity_value v, const char* str,
default: break;
}
if(inet_ntop(af, sinaddr, dest, (socklen_t)sizeof(dest)) == 0) {
strlcpy(dest, "(inet_ntop error)", sizeof(dest));
(void)strlcpy(dest, "(inet_ntop error)", sizeof(dest));
}
dest[sizeof(dest)-1] = 0;
port = ntohs(((struct sockaddr_in*)addr)->sin_port);
@ -181,7 +181,7 @@ extstrtoaddr(const char* str, struct sockaddr_storage* addr,
if(s-str >= MAX_ADDR_STRLEN) {
return 0;
}
strlcpy(buf, str, sizeof(buf));
(void)strlcpy(buf, str, sizeof(buf));
buf[s-str] = 0;
port = atoi(s+1);
if(port == 0 && strcmp(s+1,"0")!=0) {
@ -211,7 +211,7 @@ ipstrtoaddr(const char* ip, int port, struct sockaddr_storage* addr,
if((s=strchr(ip, '%'))) { /* ip6%interface, rfc 4007 */
if(s-ip >= MAX_ADDR_STRLEN)
return 0;
strlcpy(buf, ip, sizeof(buf));
(void)strlcpy(buf, ip, sizeof(buf));
buf[s-ip]=0;
sa->sin6_scope_id = (uint32_t)atoi(s+1);
ip = buf;
@ -317,7 +317,7 @@ void log_name_addr(enum verbosity_value v, const char* str, uint8_t* zone,
default: break;
}
if(inet_ntop(af, sinaddr, dest, (socklen_t)sizeof(dest)) == 0) {
strlcpy(dest, "(inet_ntop error)", sizeof(dest));
(void)strlcpy(dest, "(inet_ntop error)", sizeof(dest));
}
dest[sizeof(dest)-1] = 0;
port = ntohs(((struct sockaddr_in*)addr)->sin_port);

View file

@ -423,7 +423,7 @@ static void p_ancil(const char* str, struct comm_reply* r)
char buf[1024];
if(inet_ntop(AF_INET6, &r->pktinfo.v6info.ipi6_addr,
buf, (socklen_t)sizeof(buf)) == 0) {
strlcpy(buf, "(inet_ntop error)", sizeof(buf));
(void)strlcpy(buf, "(inet_ntop error)", sizeof(buf));
}
buf[sizeof(buf)-1]=0;
log_info("%s: %s %d", str, buf, r->pktinfo.v6info.ipi6_ifindex);
@ -432,13 +432,13 @@ static void p_ancil(const char* str, struct comm_reply* r)
char buf1[1024], buf2[1024];
if(inet_ntop(AF_INET, &r->pktinfo.v4info.ipi_addr,
buf1, (socklen_t)sizeof(buf1)) == 0) {
strlcpy(buf1, "(inet_ntop error)", sizeof(buf1));
(void)strlcpy(buf1, "(inet_ntop error)", sizeof(buf1));
}
buf1[sizeof(buf1)-1]=0;
#ifdef HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST
if(inet_ntop(AF_INET, &r->pktinfo.v4info.ipi_spec_dst,
buf2, (socklen_t)sizeof(buf2)) == 0) {
strlcpy(buf2, "(inet_ntop error)", sizeof(buf2));
(void)strlcpy(buf2, "(inet_ntop error)", sizeof(buf2));
}
buf2[sizeof(buf2)-1]=0;
#else
@ -450,7 +450,7 @@ static void p_ancil(const char* str, struct comm_reply* r)
char buf1[1024];
if(inet_ntop(AF_INET, &r->pktinfo.v4addr,
buf1, (socklen_t)sizeof(buf1)) == 0) {
strlcpy(buf1, "(inet_ntop error)", sizeof(buf1));
(void)strlcpy(buf1, "(inet_ntop error)", sizeof(buf1));
}
buf1[sizeof(buf1)-1]=0;
log_info("%s: %s", str, buf1);