{
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;
void
daemon_delete(struct daemon* daemon)
{
- int i;
+ size_t i;
if(!daemon)
return;
modstack_desetup(&daemon->mods, daemon->env);
* 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 */
#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
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 +
#else
(void)cfg;
#endif /* HAVE_GETRLIMIT */
+#endif /* S_SPLINT_S */
}
/** set verbosity, check rlimits, cache settings */
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.
#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",
*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);
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);
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,
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
} 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;
}
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);
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);
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) {
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;
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);
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);
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
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);