From: Wouter Wijngaards Date: Fri, 24 Jan 2014 13:23:45 +0000 (+0000) Subject: - made lint clean. X-Git-Tag: release-1.4.22rc1~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=361cc1f51189c3f6c1e695ad16b3d2d278ae220f;p=thirdparty%2Funbound.git - made lint clean. git-svn-id: file:///svn/unbound/trunk@3050 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/daemon/daemon.c b/daemon/daemon.c index c234eee11..44d0b87c9 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -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); diff --git a/daemon/daemon.h b/daemon/daemon.h index f91232be6..fdf7683ab 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -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 */ diff --git a/daemon/unbound.c b/daemon/unbound.c index 8de3f6b98..76e82692c 100644 --- a/daemon/unbound.c +++ b/daemon/unbound.c @@ -66,9 +66,12 @@ #include #endif +#ifndef S_SPLINT_S +/* splint chokes on this system header file */ #ifdef HAVE_SYS_RESOURCE_H #include #endif +#endif /* S_SPLINT_S */ #ifdef HAVE_LOGIN_CAP_H #include #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 */ diff --git a/doc/Changelog b/doc/Changelog index 27a1f6ecd..5457b4110 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -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. diff --git a/services/listen_dnsport.c b/services/listen_dnsport.c index cd9bce8af..63521e3e8 100644 --- a/services/listen_dnsport.c +++ b/services/listen_dnsport.c @@ -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); diff --git a/smallapp/unbound-checkconf.c b/smallapp/unbound-checkconf.c index 47c1d2a9d..4ee268272 100644 --- a/smallapp/unbound-checkconf.c +++ b/smallapp/unbound-checkconf.c @@ -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); diff --git a/testcode/delayer.c b/testcode/delayer.c index db705cf96..83e57e339 100644 --- a/testcode/delayer.c +++ b/testcode/delayer.c @@ -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, diff --git a/util/config_file.c b/util/config_file.c index 931605f44..510f0d3e1 100644 --- a/util/config_file.c +++ b/util/config_file.c @@ -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); diff --git a/util/net_help.c b/util/net_help.c index 079efb1a9..2bba16e59 100644 --- a/util/net_help.c +++ b/util/net_help.c @@ -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); diff --git a/util/netevent.c b/util/netevent.c index 4ba521447..e792bbde4 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -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);