diff --git a/bin/dig/dig.c b/bin/dig/dig.c index 7302a7ad04..19acabc807 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.c,v 1.174 2001/11/30 01:02:05 gson Exp $ */ +/* $Id: dig.c,v 1.175 2001/11/30 01:58:38 gson Exp $ */ #include #include @@ -216,14 +216,12 @@ void received(int bytes, isc_sockaddr_t *from, dig_query_t *query) { isc_uint64_t diff; isc_time_t now; - isc_result_t result; time_t tnow; char fromtext[ISC_SOCKADDR_FORMATSIZE]; isc_sockaddr_format(from, fromtext, sizeof(fromtext)); - result = isc_time_now(&now); - check_result(result, "isc_time_now"); + TIME_NOW(&now); if (query->lookup->stats && !short_form) { diff = isc_time_microdiff(&now, &query->time_sent); @@ -285,9 +283,7 @@ say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) { result = dns_rdata_totext(rdata, NULL, buf); check_result(result, "dns_rdata_totext"); if (query->lookup->identify) { - result = isc_time_now(&now); - if (result != ISC_R_SUCCESS) - return (result); + TIME_NOW(&now); diff = isc_time_microdiff(&now, &query->time_sent); ADD_STRING(buf, " from server "); ADD_STRING(buf, query->servname); diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 5727837877..1c32a9ff07 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dighost.c,v 1.237 2001/11/27 00:55:30 gson Exp $ */ +/* $Id: dighost.c,v 1.238 2001/11/30 01:58:39 gson Exp $ */ /* * Notice to programmers: Do not use this code as an example of how to @@ -1660,8 +1660,7 @@ send_udp(dig_query_t *query) { ISC_LIST_ENQUEUE(query->sendlist, &l->sendbuf, link); debug("sending a request"); - result = isc_time_now(&query->time_sent); - check_result(result, "isc_time_now"); + TIME_NOW(&query->time_sent); INSIST(query->sock != NULL); result = isc_socket_sendtov(query->sock, &query->sendlist, global_task, send_done, query, @@ -1867,8 +1866,7 @@ launch_next_query(dig_query_t *query, isc_boolean_t include_question) { debug("recvcount=%d",recvcount); if (!query->first_soa_rcvd) { debug("sending a request in launch_next_query"); - result = isc_time_now(&query->time_sent); - check_result(result, "isc_time_now"); + TIME_NOW(&query->time_sent); result = isc_socket_sendv(query->sock, &query->sendlist, global_task, send_done, query); check_result(result, "isc_socket_sendv"); diff --git a/bin/dig/host.c b/bin/dig/host.c index 927855c720..8f9a2127a7 100644 --- a/bin/dig/host.c +++ b/bin/dig/host.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: host.c,v 1.81 2001/11/29 01:21:19 gson Exp $ */ +/* $Id: host.c,v 1.82 2001/11/30 01:58:40 gson Exp $ */ #include #include @@ -147,14 +147,12 @@ dighost_shutdown(void) { void received(int bytes, isc_sockaddr_t *from, dig_query_t *query) { isc_time_t now; - isc_result_t result; int diff; if (!short_form) { char fromtext[ISC_SOCKADDR_FORMATSIZE]; isc_sockaddr_format(from, fromtext, sizeof(fromtext)); - result = isc_time_now(&now); - check_result(result, "isc_time_now"); + TIME_NOW(&now); diff = (int) isc_time_microdiff(&now, &query->time_sent); printf("Received %u bytes from %s in %d ms\n", bytes, fromtext, diff/1000); diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c index 790689370e..2c233e4922 100644 --- a/bin/dnssec/dnssec-signzone.c +++ b/bin/dnssec/dnssec-signzone.c @@ -17,7 +17,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnssec-signzone.c,v 1.154 2001/11/29 00:39:07 bwelling Exp $ */ +/* $Id: dnssec-signzone.c,v 1.155 2001/11/30 01:58:42 gson Exp $ */ #include @@ -1650,7 +1650,7 @@ main(int argc, char *argv[]) { origin = file; gdb = NULL; - isc_time_now(&timer_start); + TIME_NOW(&timer_start); loadzone(file, origin, rdclass, &gdb); gorigin = dns_db_origin(gdb); @@ -1814,7 +1814,7 @@ main(int argc, char *argv[]) { (void) isc_app_finish(); if (printstats) { - isc_time_now(&timer_finish); + TIME_NOW(&timer_finish); print_stats(&timer_start, &timer_finish); } diff --git a/bin/named/client.c b/bin/named/client.c index c798f72ff5..2fb763b4f4 100644 --- a/bin/named/client.c +++ b/bin/named/client.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: client.c,v 1.198 2001/11/16 20:01:57 gson Exp $ */ +/* $Id: client.c,v 1.199 2001/11/30 01:58:43 gson Exp $ */ #include @@ -1050,7 +1050,8 @@ client_addopt(ns_client_t *client) { ISC_LIST_INIT(rdatalist->rdata); ISC_LIST_APPEND(rdatalist->rdata, rdata, link); - dns_rdatalist_tordataset(rdatalist, rdataset); + RUNTIME_CHECK(dns_rdatalist_tordataset(rdatalist, rdataset) + == ISC_R_SUCCESS); client->opt = rdataset; diff --git a/bin/named/config.c b/bin/named/config.c index 4065ec6bd2..f7652ab2a1 100644 --- a/bin/named/config.c +++ b/bin/named/config.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: config.c,v 1.22 2001/11/27 00:55:32 gson Exp $ */ +/* $Id: config.c,v 1.23 2001/11/30 01:58:44 gson Exp $ */ #include @@ -440,7 +440,7 @@ ns_config_getport(cfg_obj_t *config, in_port_t *portp) { isc_result_t result; int i; - cfg_map_get(config, "options", &options); + (void)cfg_map_get(config, "options", &options); i = 0; if (options != NULL) maps[i++] = options; diff --git a/bin/named/lwdclient.c b/bin/named/lwdclient.c index a57c4ab95f..df104eefc5 100644 --- a/bin/named/lwdclient.c +++ b/bin/named/lwdclient.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lwdclient.c,v 1.15 2001/11/27 00:55:33 gson Exp $ */ +/* $Id: lwdclient.c,v 1.16 2001/11/30 01:58:45 gson Exp $ */ #include @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -211,6 +212,7 @@ process_request(ns_lwdclient_t *client) { void ns_lwdclient_recv(isc_task_t *task, isc_event_t *ev) { + isc_result_t result; ns_lwdclient_t *client = ev->ev_arg; ns_lwdclientmgr_t *cm = client->clientmgr; isc_socketevent_t *dev = (isc_socketevent_t *)ev; @@ -250,7 +252,13 @@ ns_lwdclient_recv(isc_task_t *task, isc_event_t *ev) { isc_event_free(&ev); dev = NULL; - ns_lwdclient_startrecv(cm); + result = ns_lwdclient_startrecv(cm); + if (result != ISC_R_SUCCESS) + isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, + NS_LOGMODULE_LWRESD, ISC_LOG_ERROR, + "could not start lwres " + "client handler: %s", + isc_result_totext(result)); process_request(client); } @@ -366,6 +374,7 @@ lwdclientmgr_shutdown_callback(isc_task_t *task, isc_event_t *ev) { void ns_lwdclient_stateidle(ns_lwdclient_t *client) { ns_lwdclientmgr_t *cm; + isc_result_t result; cm = client->clientmgr; @@ -380,7 +389,13 @@ ns_lwdclient_stateidle(ns_lwdclient_t *client) { NS_LWDCLIENT_SETIDLE(client); - ns_lwdclient_startrecv(cm); + result = ns_lwdclient_startrecv(cm); + if (result != ISC_R_SUCCESS) + isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, + NS_LOGMODULE_LWRESD, ISC_LOG_ERROR, + "could not start lwres " + "client handler: %s", + isc_result_totext(result)); } void diff --git a/bin/named/lwresd.c b/bin/named/lwresd.c index 599202099a..bbc7e631c0 100644 --- a/bin/named/lwresd.c +++ b/bin/named/lwresd.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lwresd.c,v 1.38 2001/11/27 00:55:36 gson Exp $ */ +/* $Id: lwresd.c,v 1.39 2001/11/30 01:58:46 gson Exp $ */ /* * Main program for the Lightweight Resolver Daemon. @@ -341,7 +341,7 @@ ns_lwdmanager_create(isc_mem_t *mctx, cfg_obj_t *lwres, } searchobj = NULL; - cfg_map_get(lwres, "search", &searchobj); + (void)cfg_map_get(lwres, "search", &searchobj); if (searchobj != NULL) { lwresd->search = NULL; result = ns_lwsearchlist_create(lwresd->mctx, @@ -615,7 +615,13 @@ listener_startclients(ns_lwreslistener_t *listener) { LOCK(&listener->lock); cm = ISC_LIST_HEAD(listener->cmgrs); while (cm != NULL) { - ns_lwdclient_startrecv(cm); + result = ns_lwdclient_startrecv(cm); + if (result != ISC_R_SUCCESS) + isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, + NS_LOGMODULE_LWRESD, ISC_LOG_ERROR, + "could not start lwres " + "client handler: %s", + isc_result_totext(result)); cm = ISC_LIST_NEXT(cm, link); } UNLOCK(&listener->lock); @@ -783,7 +789,7 @@ ns_lwresd_configure(isc_mem_t *mctx, cfg_obj_t *config) { port = LWRES_UDP_PORT; listenerslist = NULL; - cfg_map_get(lwres, "listen-on", &listenerslist); + (void)cfg_map_get(lwres, "listen-on", &listenerslist); if (listenerslist == NULL) { struct in_addr localhost; isc_sockaddr_t address; diff --git a/bin/named/query.c b/bin/named/query.c index c99f33dbac..a70506f7d9 100644 --- a/bin/named/query.c +++ b/bin/named/query.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: query.c,v 1.213 2001/11/26 22:54:16 gson Exp $ */ +/* $Id: query.c,v 1.214 2001/11/30 01:58:47 gson Exp $ */ #include @@ -1420,7 +1420,7 @@ query_addadditional(void *arg, dns_name_t *name, dns_rdatatype_t qtype) { */ if (a6rdataset != NULL) { dns_a6_reset(&client->query.a6ctx); - dns_a6_foreach(&client->query.a6ctx, a6rdataset, client->now); + (void)dns_a6_foreach(&client->query.a6ctx, a6rdataset, client->now); } cleanup: @@ -1705,7 +1705,9 @@ query_addsoa(ns_client_t *client, dns_db_t *db, isc_boolean_t zero_ttl) { result = dns_rdataset_first(rdataset); RUNTIME_CHECK(result == ISC_R_SUCCESS); dns_rdataset_current(rdataset, &rdata); - dns_rdata_tostruct(&rdata, &soa, NULL); + result = dns_rdata_tostruct(&rdata, &soa, NULL); + if (result != ISC_R_SUCCESS) + goto cleanup; if (zero_ttl) { rdataset->ttl = 0; @@ -1870,7 +1872,8 @@ query_addcnamelike(ns_client_t *client, dns_name_t *qname, dns_name_t *tname, ISC_LIST_INIT(rdatalist->rdata); ISC_LIST_APPEND(rdatalist->rdata, rdata, link); - dns_rdatalist_tordataset(rdatalist, rdataset); + RUNTIME_CHECK(dns_rdatalist_tordataset(rdatalist, rdataset) + == ISC_R_SUCCESS); query_addrrset(client, anamep, &rdataset, NULL, NULL, DNS_SECTION_ANSWER); @@ -3072,8 +3075,8 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) * since the synthesized CNAME is NOT in the zone. */ dns_name_init(tname, NULL); - query_addcnamelike(client, client->query.qname, fname, - 0, &tname, dns_rdatatype_cname); + (void)query_addcnamelike(client, client->query.qname, fname, + 0, &tname, dns_rdatatype_cname); if (tname != NULL) dns_message_puttempname(client->message, &tname); /* @@ -3214,7 +3217,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) qtype == dns_rdatatype_any) && dns_name_equal(client->query.qname, dns_db_origin(db)))) - query_addns(client, db); + (void)query_addns(client, db); } else if (qtype != dns_rdatatype_ns) { if (fname != NULL) query_releasename(client, &fname); @@ -3551,7 +3554,7 @@ synth_fwd_startfind(ns_client_t *client) { ptarget = query_newname(client, dbuf, &b); if (ptarget == NULL) goto fail; - dns_name_copy(target, ptarget, NULL); + RUNTIME_CHECK(dns_name_copy(target, ptarget, NULL) == ISC_R_SUCCESS); dns_adb_destroyfind(&find); @@ -3692,7 +3695,8 @@ synth_fwd_respond(ns_client_t *client, dns_adbfind_t *find) { ISC_LIST_APPEND(rdatalist->rdata, rdata, link); } - dns_rdatalist_tordataset(rdatalist, rdataset); + RUNTIME_CHECK(dns_rdatalist_tordataset(rdatalist, rdataset) + == ISC_R_SUCCESS); query_addrrset(client, &tname, &rdataset, NULL, NULL, DNS_SECTION_ANSWER); diff --git a/bin/named/server.c b/bin/named/server.c index 00ccb4c647..681541e4cc 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.364 2001/11/27 04:06:07 marka Exp $ */ +/* $Id: server.c,v 1.365 2001/11/30 01:58:49 gson Exp $ */ #include @@ -148,7 +148,7 @@ configure_view_acl(cfg_obj_t *vconfig, cfg_obj_t *config, maps[i++] = cfg_tuple_get(vconfig, "options"); if (config != NULL) { cfg_obj_t *options = NULL; - cfg_map_get(config, "options", &options); + (void)cfg_map_get(config, "options", &options); if (options != NULL) maps[i++] = options; } @@ -424,36 +424,38 @@ configure_peer(cfg_obj_t *cpeer, isc_mem_t *mctx, dns_peer_t **peerp) { obj = NULL; (void)cfg_map_get(cpeer, "bogus", &obj); if (obj != NULL) - dns_peer_setbogus(peer, cfg_obj_asboolean(obj)); + CHECK(dns_peer_setbogus(peer, cfg_obj_asboolean(obj))); obj = NULL; (void)cfg_map_get(cpeer, "provide-ixfr", &obj); if (obj != NULL) - dns_peer_setprovideixfr(peer, cfg_obj_asboolean(obj)); + CHECK(dns_peer_setprovideixfr(peer, cfg_obj_asboolean(obj))); obj = NULL; (void)cfg_map_get(cpeer, "request-ixfr", &obj); if (obj != NULL) - dns_peer_setrequestixfr(peer, cfg_obj_asboolean(obj)); + CHECK(dns_peer_setrequestixfr(peer, cfg_obj_asboolean(obj))); obj = NULL; (void)cfg_map_get(cpeer, "edns", &obj); if (obj != NULL) - dns_peer_setsupportedns(peer, cfg_obj_asboolean(obj)); + CHECK(dns_peer_setsupportedns(peer, cfg_obj_asboolean(obj))); obj = NULL; (void)cfg_map_get(cpeer, "transfers", &obj); if (obj != NULL) - dns_peer_settransfers(peer, cfg_obj_asuint32(obj)); + CHECK(dns_peer_settransfers(peer, cfg_obj_asuint32(obj))); obj = NULL; (void)cfg_map_get(cpeer, "transfer-format", &obj); if (obj != NULL) { str = cfg_obj_asstring(obj); if (strcasecmp(str, "many-answers") == 0) - dns_peer_settransferformat(peer, dns_many_answers); + CHECK(dns_peer_settransferformat(peer, + dns_many_answers)); else if (strcasecmp(str, "one-answer") == 0) - dns_peer_settransferformat(peer, dns_one_answer); + CHECK(dns_peer_settransferformat(peer, + dns_one_answer)); else INSIST(0); } @@ -514,7 +516,7 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, cmctx = NULL; if (config != NULL) - cfg_map_get(config, "options", &options); + (void)cfg_map_get(config, "options", &options); i = 0; if (vconfig != NULL) { @@ -596,7 +598,7 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, obj = NULL; result = ns_config_get(maps, "cache-file", &obj); if (result == ISC_R_SUCCESS) { - dns_cache_setfilename(cache, cfg_obj_asstring(obj)); + CHECK(dns_cache_setfilename(cache, cfg_obj_asstring(obj))); if (!reused_cache) CHECK(dns_cache_load(cache)); } @@ -1207,7 +1209,7 @@ configure_zone(cfg_obj_t *config, cfg_obj_t *zconfig, cfg_obj_t *vconfig, if (cfg_map_get(zoptions, "forwarders", &forwarders) == ISC_R_SUCCESS) { forwardtype = NULL; - cfg_map_get(zoptions, "forward", &forwardtype); + (void)cfg_map_get(zoptions, "forward", &forwardtype); CHECK(configure_forward(config, view, origin, forwarders, forwardtype)); } @@ -1639,14 +1641,15 @@ load_configuration(const char *filename, ns_server_t *server, INSIST(result == ISC_R_SUCCESS); interface_interval = cfg_obj_asuint32(obj) * 60; if (interface_interval == 0) { - isc_timer_reset(server->interface_timer, - isc_timertype_inactive, - NULL, NULL, ISC_TRUE); + CHECK(isc_timer_reset(server->interface_timer, + isc_timertype_inactive, + NULL, NULL, ISC_TRUE)); } else if (server->interface_interval != interface_interval) { isc_interval_t interval; isc_interval_set(&interval, interface_interval, 0); - isc_timer_reset(server->interface_timer, isc_timertype_ticker, - NULL, &interval, ISC_FALSE); + CHECK(isc_timer_reset(server->interface_timer, + isc_timertype_ticker, + NULL, &interval, ISC_FALSE)); } server->interface_interval = interface_interval; @@ -1658,14 +1661,15 @@ load_configuration(const char *filename, ns_server_t *server, INSIST(result == ISC_R_SUCCESS); heartbeat_interval = cfg_obj_asuint32(obj) * 60; if (heartbeat_interval == 0) { - isc_timer_reset(server->heartbeat_timer, - isc_timertype_inactive, - NULL, NULL, ISC_TRUE); + CHECK(isc_timer_reset(server->heartbeat_timer, + isc_timertype_inactive, + NULL, NULL, ISC_TRUE)); } else if (server->heartbeat_interval != heartbeat_interval) { isc_interval_t interval; isc_interval_set(&interval, heartbeat_interval, 0); - isc_timer_reset(server->heartbeat_timer, isc_timertype_ticker, - NULL, &interval, ISC_FALSE); + CHECK(isc_timer_reset(server->heartbeat_timer, + isc_timertype_ticker, + NULL, &interval, ISC_FALSE)); } server->heartbeat_interval = heartbeat_interval; @@ -2476,10 +2480,10 @@ ns_server_reloadcommand(ns_server_t *server, char *args) { if (type == dns_zone_slave || type == dns_zone_stub) dns_zone_refresh(zone); else - dns_zone_load(zone); + result = dns_zone_load(zone); dns_zone_detach(&zone); } - return (ISC_R_SUCCESS); + return (result); } /* diff --git a/bin/named/unix/os.c b/bin/named/unix/os.c index 7f54b2b265..007e8237b4 100644 --- a/bin/named/unix/os.c +++ b/bin/named/unix/os.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: os.c,v 1.55 2001/11/23 01:15:07 marka Exp $ */ +/* $Id: os.c,v 1.56 2001/11/30 01:58:54 gson Exp $ */ #include #include @@ -271,7 +271,6 @@ setup_syslog(const char *progname) { #ifdef LOG_NDELAY options |= LOG_NDELAY; #endif - openlog(isc_file_basename(progname), options, ISC_FACILITY); } @@ -325,11 +324,11 @@ ns_os_daemonize(void) { */ fd = open("/dev/null", O_RDWR, 0); if (fd != -1) { - close(STDIN_FILENO); + (void)close(STDIN_FILENO); (void)dup2(fd, STDIN_FILENO); - close(STDOUT_FILENO); + (void)close(STDOUT_FILENO); (void)dup2(fd, STDOUT_FILENO); - close(STDERR_FILENO); + (void)close(STDERR_FILENO); (void)dup2(fd, STDERR_FILENO); if (fd != STDIN_FILENO && fd != STDOUT_FILENO && diff --git a/bin/named/update.c b/bin/named/update.c index 14d785d87d..27ef58ef7f 100644 --- a/bin/named/update.c +++ b/bin/named/update.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: update.c,v 1.90 2001/11/20 05:04:41 marka Exp $ */ +/* $Id: update.c,v 1.91 2001/11/30 01:58:50 gson Exp $ */ #include @@ -1257,9 +1257,8 @@ namelist_append_subdomain(dns_db_t *db, dns_name_t *name, dns_diff_t *affected) result = dns_dbiterator_next(dbit)) { dns_dbnode_t *node = NULL; - result = dns_dbiterator_current(dbit, &node, child); + CHECK(dns_dbiterator_current(dbit, &node, child)); dns_db_detachnode(db, &node); - CHECK(result); if (! dns_name_issubdomain(child, name)) break; CHECK(namelist_append_name(affected, child)); @@ -1411,7 +1410,7 @@ next_active(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *oldname, goto failure; } } - dns_dbiterator_current(dbit, &node, newname); + CHECK(dns_dbiterator_current(dbit, &node, newname)); dns_db_detachnode(db, &node); /* @@ -1781,10 +1780,9 @@ update_signatures(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *oldver, */ CHECK(rrset_exists(db, newver, &t->name, dns_rdatatype_nxt, 0, &flag)); - if (! flag) { - add_placeholder_nxt(db, newver, &t->name, - diff); - } + if (! flag) + CHECK(add_placeholder_nxt(db, newver, &t->name, + diff)); } } diff --git a/bin/named/xfrout.c b/bin/named/xfrout.c index 4f32463b8c..6661fbd9a3 100644 --- a/bin/named/xfrout.c +++ b/bin/named/xfrout.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: xfrout.c,v 1.106 2001/11/27 00:55:37 gson Exp $ */ +/* $Id: xfrout.c,v 1.107 2001/11/30 01:58:51 gson Exp $ */ #include @@ -242,7 +242,7 @@ db_rr_iterator_next(db_rr_iterator_t *it) { static void db_rr_iterator_pause(db_rr_iterator_t *it) { - dns_dbiterator_pause(it->dbit); + RUNTIME_CHECK(dns_dbiterator_pause(it->dbit) == ISC_R_SUCCESS); } static void @@ -1326,7 +1326,7 @@ sendstream(xfrout_ctx_t *xfr) { msg->flags = DNS_MESSAGEFLAG_QR | DNS_MESSAGEFLAG_AA; if ((xfr->client->attributes & NS_CLIENTATTR_RA) != 0) msg->flags |= DNS_MESSAGEFLAG_RA; - dns_message_settsigkey(msg, xfr->tsigkey); + CHECK(dns_message_settsigkey(msg, xfr->tsigkey)); CHECK(dns_message_setquerytsig(msg, xfr->lasttsig)); if (xfr->lasttsig != NULL) isc_buffer_free(&xfr->lasttsig); diff --git a/bin/named/zoneconf.c b/bin/named/zoneconf.c index 93d1006ffd..c5a5b8e87b 100644 --- a/bin/named/zoneconf.c +++ b/bin/named/zoneconf.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zoneconf.c,v 1.96 2001/11/08 05:36:23 marka Exp $ */ +/* $Id: zoneconf.c,v 1.97 2001/11/30 01:58:52 gson Exp $ */ #include @@ -410,7 +410,7 @@ ns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig, obj = NULL; result = ns_config_get(maps, "zone-statistics", &obj); INSIST(result == ISC_R_SUCCESS); - dns_zone_setstatistics(zone, cfg_obj_asboolean(obj)); + RETERR(dns_zone_setstatistics(zone, cfg_obj_asboolean(obj))); /* * Configure master functionality. This applies @@ -455,12 +455,12 @@ ns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig, obj = NULL; result = ns_config_get(maps, "notify-source", &obj); INSIST(result == ISC_R_SUCCESS); - dns_zone_setnotifysrc4(zone, cfg_obj_assockaddr(obj)); + RETERR(dns_zone_setnotifysrc4(zone, cfg_obj_assockaddr(obj))); obj = NULL; result = ns_config_get(maps, "notify-source-v6", &obj); INSIST(result == ISC_R_SUCCESS); - dns_zone_setnotifysrc6(zone, cfg_obj_assockaddr(obj)); + RETERR(dns_zone_setnotifysrc6(zone, cfg_obj_assockaddr(obj))); RETERR(configure_zone_acl(zconfig, vconfig, config, "allow-transfer", ac, zone, @@ -596,12 +596,12 @@ ns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig, obj = NULL; result = ns_config_get(maps, "transfer-source", &obj); INSIST(result == ISC_R_SUCCESS); - dns_zone_setxfrsource4(zone, cfg_obj_assockaddr(obj)); + RETERR(dns_zone_setxfrsource4(zone, cfg_obj_assockaddr(obj))); obj = NULL; result = ns_config_get(maps, "transfer-source-v6", &obj); INSIST(result == ISC_R_SUCCESS); - dns_zone_setxfrsource6(zone, cfg_obj_assockaddr(obj)); + RETERR(dns_zone_setxfrsource6(zone, cfg_obj_assockaddr(obj))); break; diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c index f33e8072e9..746e04d4d3 100644 --- a/bin/rndc/rndc.c +++ b/bin/rndc/rndc.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rndc.c,v 1.86 2001/11/27 04:06:13 marka Exp $ */ +/* $Id: rndc.c,v 1.87 2001/11/30 01:58:55 gson Exp $ */ /* * Principal Author: DCL @@ -343,7 +343,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname, fatal("no server specified and no default"); if (!key_only) { - cfg_map_get(config, "server", &servers); + (void)cfg_map_get(config, "server", &servers); if (servers != NULL) { for (elt = cfg_list_first(servers); elt != NULL; @@ -419,7 +419,7 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname, if (server != NULL) (void)cfg_map_get(server, "port", &defport); if (defport == NULL && options != NULL) - cfg_map_get(options, "default-port", &defport); + (void)cfg_map_get(options, "default-port", &defport); } if (defport != NULL) { remoteport = cfg_obj_asuint32(defport); @@ -456,7 +456,9 @@ main(int argc, char **argv) { admin_conffile = RNDC_CONFFILE; admin_keyfile = RNDC_KEYFILE; - isc_app_start(); + result = isc_app_start(); + if (result != ISC_R_SUCCESS) + fatal("isc_app_start() failed: %s", isc_result_totext(result)); while ((ch = isc_commandline_parse(argc, argv, "c:k:Mmp:s:Vy:")) != -1) { @@ -566,7 +568,9 @@ main(int argc, char **argv) { DO("post event", isc_app_onrun(mctx, task, rndc_start, NULL)); - isc_app_run(); + result = isc_app_run(); + if (result != ISC_R_SUCCESS) + fatal("isc_app_run() failed: %s", isc_result_totext(result)); if (connects > 0 || sends > 0 || recvs > 0) isc_socket_cancel(sock, task, ISC_SOCKCANCEL_ALL); diff --git a/bin/tests/db_test.c b/bin/tests/db_test.c index f3481cb794..0c42ccdd1e 100644 --- a/bin/tests/db_test.c +++ b/bin/tests/db_test.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: db_test.c,v 1.57 2001/11/27 01:55:15 gson Exp $ */ +/* $Id: db_test.c,v 1.58 2001/11/30 01:58:56 gson Exp $ */ /* * Principal Author: Bob Halley @@ -466,7 +466,7 @@ main(int argc, char *argv[]) { version = NULL; if (time_lookups) { - (void)isc_time_now(&start); + TIME_NOW(&start); } while (!done) { @@ -923,7 +923,7 @@ main(int argc, char *argv[]) { if (time_lookups) { isc_uint64_t usec; - (void)isc_time_now(&finish); + TIME_NOW(&finish); usec = isc_time_microdiff(&finish, &start); diff --git a/bin/tests/entropy2_test.c b/bin/tests/entropy2_test.c index 7002cfc1b7..a05db07359 100644 --- a/bin/tests/entropy2_test.c +++ b/bin/tests/entropy2_test.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: entropy2_test.c,v 1.10 2001/11/27 00:55:40 gson Exp $ */ +/* $Id: entropy2_test.c,v 1.11 2001/11/30 01:58:57 gson Exp $ */ #include @@ -97,9 +97,7 @@ get(isc_entropysource_t *source, void *arg, isc_boolean_t blocking) { if (result != ISC_R_SUCCESS) return (result); - result = isc_time_now(&t); - if (result != ISC_R_SUCCESS) - return (result); + TIME_NOW(&t); sample = isc_time_nanoseconds(&t); extra = c; diff --git a/bin/tests/tasks/t_tasks.c b/bin/tests/tasks/t_tasks.c index 7879e0de22..f1a8e8d10f 100644 --- a/bin/tests/tasks/t_tasks.c +++ b/bin/tests/tasks/t_tasks.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: t_tasks.c,v 1.30 2001/11/27 01:55:31 gson Exp $ */ +/* $Id: t_tasks.c,v 1.31 2001/11/30 01:58:59 gson Exp $ */ #include @@ -350,7 +350,7 @@ t_tasks1(void) { isc_task_send(task4, &event); - isc_task_purge(task3, NULL, 0, 0); + (void)isc_task_purge(task3, NULL, 0, 0); isc_task_detach(&task1); isc_task_detach(&task2); diff --git a/bin/tests/timer_test.c b/bin/tests/timer_test.c index 7185e44b7d..d82866cc5d 100644 --- a/bin/tests/timer_test.c +++ b/bin/tests/timer_test.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: timer_test.c,v 1.36 2001/01/09 21:41:45 bwelling Exp $ */ +/* $Id: timer_test.c,v 1.37 2001/11/30 01:58:58 gson Exp $ */ #include @@ -130,7 +130,7 @@ main(int argc, char *argv[]) { printf("task 2: %p\n", t2); printf("task 3: %p\n", t3); - (void)isc_time_now(&now); + TIME_NOW(&now); isc_interval_set(&interval, 2, 0); RUNTIME_CHECK(isc_timer_create(timgr, isc_timertype_once, NULL, diff --git a/doc/dev/coding.html b/doc/dev/coding.html index 9008332d93..10b3195afb 100644 --- a/doc/dev/coding.html +++ b/doc/dev/coding.html @@ -15,7 +15,7 @@ - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --> - +

C Language

@@ -291,7 +291,18 @@ spaces.

Return Values

If a function returns a value, it should be cast to (void) if you don't -care what the value is, except for printf

+care what the value is, except for printf and its variants, +fputc, fwrite (when writing text), +fflush, +memcpy, memmove, memset, +strcpy, strncpy, and strcat. +

+ +Certain functions return values or not depending on the operating +system or even compiler flags; these include +these include openlog and srandom. +The return value of these should not be used nor cast to (void). +

All error conditions must be handled.

diff --git a/lib/bind9/check.c b/lib/bind9/check.c index 19fa83ff44..766a656250 100644 --- a/lib/bind9/check.c +++ b/lib/bind9/check.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: check.c,v 1.9 2001/11/16 04:43:04 bwelling Exp $ */ +/* $Id: check.c,v 1.10 2001/11/30 01:59:02 gson Exp $ */ #include @@ -287,7 +287,7 @@ check_zoneconf(cfg_obj_t *zconfig, isc_symtab_t *symtab, */ if (ztype == MASTERZONE || ztype == SLAVEZONE || ztype == STUBZONE) { cfg_obj_t *dialup = NULL; - cfg_map_get(zoptions, "dialup", &dialup); + (void)cfg_map_get(zoptions, "dialup", &dialup); if (dialup != NULL && cfg_obj_isstring(dialup)) { char *str = cfg_obj_asstring(dialup); for (i = 0; @@ -338,8 +338,8 @@ bind9_check_key(cfg_obj_t *key, isc_log_t *logctx) { cfg_obj_t *secretobj = NULL; const char *keyname = cfg_obj_asstring(cfg_map_getname(key)); - cfg_map_get(key, "algorithm", &algobj); - cfg_map_get(key, "secret", &secretobj); + (void)cfg_map_get(key, "algorithm", &algobj); + (void)cfg_map_get(key, "secret", &secretobj); if (secretobj == NULL || algobj == NULL) { cfg_obj_log(key, logctx, ISC_LOG_ERROR, "key '%s' must have both 'secret' and " @@ -427,7 +427,7 @@ check_viewconf(cfg_obj_t *config, cfg_obj_t *vconfig, dns_rdataclass_t vclass, if (tresult != ISC_R_SUCCESS) return (ISC_R_NOMEMORY); - cfg_map_get(config, "key", &keys); + (void)cfg_map_get(config, "key", &keys); tresult = check_keylist(keys, symtab, logctx); if (tresult == ISC_R_EXISTS) result = ISC_R_FAILURE; @@ -455,7 +455,7 @@ check_viewconf(cfg_obj_t *config, cfg_obj_t *vconfig, dns_rdataclass_t vclass, */ if (vconfig == NULL) { cfg_obj_t *options = NULL; - cfg_map_get(config, "options", &options); + (void)cfg_map_get(config, "options", &options); if (options != NULL) if (check_forward(options, logctx) != ISC_R_SUCCESS) result = ISC_R_FAILURE; diff --git a/lib/dns/adb.c b/lib/dns/adb.c index d267408899..e1d7354a75 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: adb.c,v 1.194 2001/11/27 03:00:48 marka Exp $ */ +/* $Id: adb.c,v 1.195 2001/11/30 01:59:03 gson Exp $ */ /* * Implementation notes @@ -2139,8 +2139,8 @@ destroy(dns_adb_t *adb) { isc_mempool_destroy(&adb->afmp); isc_mempool_destroy(&adb->af6mp); - isc_mutexblock_destroy(adb->entrylocks, NBUCKETS); - isc_mutexblock_destroy(adb->namelocks, NBUCKETS); + DESTROYMUTEXBLOCK(adb->entrylocks, NBUCKETS); + DESTROYMUTEXBLOCK(adb->namelocks, NBUCKETS); DESTROYLOCK(&adb->reflock); DESTROYLOCK(&adb->lock); @@ -2298,10 +2298,10 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr, isc_timer_detach(&adb->timer); /* clean up entrylocks */ - isc_mutexblock_destroy(adb->entrylocks, NBUCKETS); + DESTROYMUTEXBLOCK(adb->entrylocks, NBUCKETS); fail2: /* clean up namelocks */ - isc_mutexblock_destroy(adb->namelocks, NBUCKETS); + DESTROYMUTEXBLOCK(adb->namelocks, NBUCKETS); fail1: /* clean up only allocated memory */ if (adb->nmp != NULL) diff --git a/lib/dns/cache.c b/lib/dns/cache.c index a5135fbbeb..3f739973b5 100644 --- a/lib/dns/cache.c +++ b/lib/dns/cache.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: cache.c,v 1.51 2001/11/27 03:10:29 marka Exp $ */ +/* $Id: cache.c,v 1.52 2001/11/30 01:59:05 gson Exp $ */ #include @@ -350,7 +350,12 @@ dns_cache_detach(dns_cache_t **cachep) { * When the cache is shut down, dump it to a file if one is * specified. */ - dns_cache_dump(cache); + isc_result_t result = dns_cache_dump(cache); + if (result != ISC_R_SUCCESS) + isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, + DNS_LOGMODULE_CACHE, ISC_LOG_WARNING, + "error dumping cache: %s ", + isc_result_totext(result)); /* * If the cleaner task exists, let it free the cache. @@ -435,6 +440,7 @@ dns_cache_dump(dns_cache_t *cache) { void dns_cache_setcleaninginterval(dns_cache_t *cache, unsigned int t) { isc_interval_t interval; + isc_result_t result; LOCK(&cache->lock); @@ -448,15 +454,22 @@ dns_cache_setcleaninginterval(dns_cache_t *cache, unsigned int t) { cache->cleaner.cleaning_interval = t; if (t == 0) { - isc_timer_reset(cache->cleaner.cleaning_timer, - isc_timertype_inactive, NULL, NULL, ISC_TRUE); + result = isc_timer_reset(cache->cleaner.cleaning_timer, + isc_timertype_inactive, + NULL, NULL, ISC_TRUE); } else { isc_interval_set(&interval, cache->cleaner.cleaning_interval, 0); - isc_timer_reset(cache->cleaner.cleaning_timer, - isc_timertype_ticker, - NULL, &interval, ISC_FALSE); + result = isc_timer_reset(cache->cleaner.cleaning_timer, + isc_timertype_ticker, + NULL, &interval, ISC_FALSE); } + if (result != ISC_R_SUCCESS) + isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, + DNS_LOGMODULE_CACHE, ISC_LOG_WARNING, + "could not set cache cleaning interval: %s", + isc_result_totext(result)); + unlock: UNLOCK(&cache->lock); } @@ -948,7 +961,7 @@ cleaner_shutdown_action(isc_task_t *task, isc_event_t *event) { isc_timer_detach(&cache->cleaner.cleaning_timer); /* Make sure we don't reschedule anymore. */ - isc_task_purge(task, NULL, DNS_EVENT_CACHECLEAN, NULL); + (void)isc_task_purge(task, NULL, DNS_EVENT_CACHECLEAN, NULL); UNLOCK(&cache->lock); diff --git a/lib/dns/dbtable.c b/lib/dns/dbtable.c index 525e2d8631..4aa750beed 100644 --- a/lib/dns/dbtable.c +++ b/lib/dns/dbtable.c @@ -16,7 +16,7 @@ */ /* - * $Id: dbtable.c,v 1.25 2001/06/04 19:33:00 tale Exp $ + * $Id: dbtable.c,v 1.26 2001/11/30 01:59:06 gson Exp $ */ /* @@ -216,7 +216,7 @@ dns_dbtable_remove(dns_dbtable_t *dbtable, dns_db_t *db) { if (result == ISC_R_SUCCESS) { INSIST(stored_data == db); - dns_rbt_deletename(dbtable->rbt, name, ISC_FALSE); + (void)dns_rbt_deletename(dbtable->rbt, name, ISC_FALSE); } RWUNLOCK(&dbtable->tree_lock, isc_rwlocktype_write); diff --git a/lib/dns/dnssec.c b/lib/dns/dnssec.c index 9daaee193b..84fa6b2bdd 100644 --- a/lib/dns/dnssec.c +++ b/lib/dns/dnssec.c @@ -16,7 +16,7 @@ */ /* - * $Id: dnssec.c,v 1.69 2001/06/08 22:48:28 bwelling Exp $ + * $Id: dnssec.c,v 1.70 2001/11/30 01:59:07 gson Exp $ */ @@ -154,7 +154,9 @@ digest_sig(dst_context_t *ctx, dns_rdata_t *sigrdata, dns_rdata_sig_t *sig) { if (ret != ISC_R_SUCCESS) return (ret); dns_fixedname_init(&fname); - dns_name_downcase(&sig->signer, dns_fixedname_name(&fname), NULL); + RUNTIME_CHECK(dns_name_downcase(&sig->signer, + dns_fixedname_name(&fname), NULL) + == ISC_R_SUCCESS); dns_name_toregion(dns_fixedname_name(&fname), &r); return (dst_context_adddata(ctx, &r)); } @@ -250,7 +252,8 @@ dns_dnssec_sign(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, goto cleanup_context; dns_fixedname_init(&fnewname); - dns_name_downcase(name, dns_fixedname_name(&fnewname), NULL); + RUNTIME_CHECK(dns_name_downcase(name, dns_fixedname_name(&fnewname), + NULL) == ISC_R_SUCCESS); dns_name_toregion(dns_fixedname_name(&fnewname), &r); /* @@ -392,11 +395,13 @@ dns_dnssec_verify(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, dns_fixedname_init(&fnewname); labels = dns_name_depth(name) - 1; if (labels - sig.labels > 0) { - dns_name_splitatdepth(name, sig.labels + 1, NULL, - dns_fixedname_name(&fnewname)); - dns_name_downcase(dns_fixedname_name(&fnewname), - dns_fixedname_name(&fnewname), - NULL); + RUNTIME_CHECK(dns_name_splitatdepth(name, sig.labels + 1, NULL, + dns_fixedname_name(&fnewname)) + == ISC_R_SUCCESS); + RUNTIME_CHECK(dns_name_downcase(dns_fixedname_name(&fnewname), + dns_fixedname_name(&fnewname), + NULL) + == ISC_R_SUCCESS); } else dns_name_downcase(name, dns_fixedname_name(&fnewname), NULL); @@ -654,7 +659,7 @@ dns_dnssec_signmessage(dns_message_t *msg, dst_key_t *key) { dataset = NULL; RETERR(dns_message_gettemprdataset(msg, &dataset)); dns_rdataset_init(dataset); - dns_rdatalist_tordataset(datalist, dataset); + RUNTIME_CHECK(dns_rdatalist_tordataset(datalist, dataset) == ISC_R_SUCCESS); msg->sig0 = dataset; return (ISC_R_SUCCESS); diff --git a/lib/dns/gen-unix.h b/lib/dns/gen-unix.h index 7d14d56f0b..02251f448d 100644 --- a/lib/dns/gen-unix.h +++ b/lib/dns/gen-unix.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: gen-unix.h,v 1.12 2001/01/09 21:50:51 bwelling Exp $ */ +/* $Id: gen-unix.h,v 1.13 2001/11/30 01:59:08 gson Exp $ */ /* * This file is responsible for defining two operations that are not @@ -82,7 +82,7 @@ next_file(isc_dir_t *dir) { static void end_directory(isc_dir_t *dir) { if (dir->handle != NULL) - closedir(dir->handle); + (void)closedir(dir->handle); dir->handle = NULL; } diff --git a/lib/dns/include/dns/peer.h b/lib/dns/include/dns/peer.h index ef13dab422..d5d47df92f 100644 --- a/lib/dns/include/dns/peer.h +++ b/lib/dns/include/dns/peer.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: peer.h,v 1.17 2001/11/09 04:21:58 marka Exp $ */ +/* $Id: peer.h,v 1.18 2001/11/30 01:59:26 gson Exp $ */ #ifndef DNS_PEER_H #define DNS_PEER_H 1 @@ -114,10 +114,10 @@ dns_peerlist_currpeer(dns_peerlist_t *peers, dns_peer_t **retval); isc_result_t dns_peer_new(isc_mem_t *mem, isc_netaddr_t *ipaddr, dns_peer_t **peer); -isc_result_t +void dns_peer_attach(dns_peer_t *source, dns_peer_t **target); -isc_result_t +void dns_peer_detach(dns_peer_t **list); isc_result_t diff --git a/lib/dns/include/dns/request.h b/lib/dns/include/dns/request.h index 1eeb54ebdf..ebd491f68d 100644 --- a/lib/dns/include/dns/request.h +++ b/lib/dns/include/dns/request.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: request.h,v 1.18 2001/10/18 06:09:39 marka Exp $ */ +/* $Id: request.h,v 1.19 2001/11/30 01:59:27 gson Exp $ */ #ifndef DNS_REQUEST_H #define DNS_REQUEST_H 1 @@ -281,7 +281,7 @@ dns_request_createraw2(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf, * requestp != NULL && *requestp == NULL */ -isc_result_t +void dns_request_cancel(dns_request_t *request); /* * Cancel 'request'. diff --git a/lib/dns/journal.c b/lib/dns/journal.c index 16bc36a8ee..00ff0c8a16 100644 --- a/lib/dns/journal.c +++ b/lib/dns/journal.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: journal.c,v 1.82 2001/10/15 04:47:55 marka Exp $ */ +/* $Id: journal.c,v 1.83 2001/11/30 01:59:09 gson Exp $ */ #include @@ -951,7 +951,7 @@ dns_journal_writediff(dns_journal_t *j, dns_diff_t *diff) { REQUIRE(j->state == JOURNAL_STATE_TRANSACTION); isc_log_write(JOURNAL_DEBUG_LOGARGS(3), "writing to journal"); - dns_diff_print(diff, NULL); + (void)dns_diff_print(diff, NULL); /* * Pass 1: determine the buffer size needed, and @@ -1264,7 +1264,7 @@ roll_forward(dns_journal_t *j, dns_db_t *db) { if (++n_put > 100) { isc_log_write(JOURNAL_DEBUG_LOGARGS(3), "applying diff to database"); - dns_diff_print(&diff, NULL); + (void)dns_diff_print(&diff, NULL); CHECK(dns_diff_apply(&diff, db, ver)); dns_diff_clear(&diff); n_put = 0; @@ -1277,7 +1277,7 @@ roll_forward(dns_journal_t *j, dns_db_t *db) { if (n_put != 0) { isc_log_write(JOURNAL_DEBUG_LOGARGS(3), "applying final diff to database"); - dns_diff_print(&diff, NULL); + (void)dns_diff_print(&diff, NULL); CHECK(dns_diff_apply(&diff, db, ver)); dns_diff_clear(&diff); } diff --git a/lib/dns/master.c b/lib/dns/master.c index 98a1f4d598..042805839b 100644 --- a/lib/dns/master.c +++ b/lib/dns/master.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: master.c,v 1.129 2001/11/27 00:55:53 gson Exp $ */ +/* $Id: master.c,v 1.130 2001/11/30 01:59:11 gson Exp $ */ #include @@ -370,7 +370,7 @@ loadctx_destroy(dns_loadctx_t *lctx) { incctx_destroy(lctx->mctx, lctx->inc); if (lctx->lex != NULL) { - isc_lex_close(lctx->lex); + (void)isc_lex_close(lctx->lex); isc_lex_destroy(&lctx->lex); } if (lctx->task != NULL) @@ -715,7 +715,7 @@ generate(dns_loadctx_t *lctx, char *range, char *lhs, char *gtype, char *rhs, result = dns_rdata_fromtext(&rdata, lctx->zclass, type, lctx->lex, ictx->origin, ISC_FALSE, lctx->mctx, &target, callbacks); - isc_lex_close(lctx->lex); + RUNTIME_CHECK(isc_lex_close(lctx->lex) == ISC_R_SUCCESS); if (result != ISC_R_SUCCESS) goto error_cleanup; @@ -857,7 +857,7 @@ load(dns_loadctx_t *lctx) { lctx->inc = ictx->parent; ictx->parent = NULL; incctx_destroy(lctx->mctx, ictx); - isc_lex_close(lctx->lex); + RUNTIME_CHECK(isc_lex_close(lctx->lex) == ISC_R_SUCCESS); line = isc_lex_getsourceline(lctx->lex); source = isc_lex_getsourcename(lctx->lex); ictx = lctx->inc; @@ -2001,7 +2001,8 @@ commit(dns_rdatacallbacks_t *callbacks, dns_loadctx_t *lctx, return (ISC_R_SUCCESS); do { dns_rdataset_init(&dataset); - dns_rdatalist_tordataset(this, &dataset); + RUNTIME_CHECK(dns_rdatalist_tordataset(this, &dataset) + == ISC_R_SUCCESS); dataset.trust = dns_trust_ultimate; result = ((*callbacks->add)(callbacks->add_private, owner, &dataset)); diff --git a/lib/dns/message.c b/lib/dns/message.c index b430b972f0..c617f7fb68 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: message.c,v 1.197 2001/11/27 00:55:55 gson Exp $ */ +/* $Id: message.c,v 1.198 2001/11/30 01:59:12 gson Exp $ */ /*** *** Imports @@ -1390,7 +1390,9 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, ISC_LIST_INIT(rdatalist->rdata); dns_rdataset_init(rdataset); - dns_rdatalist_tordataset(rdatalist, rdataset); + RUNTIME_CHECK(dns_rdatalist_tordataset(rdatalist, + rdataset) + == ISC_R_SUCCESS); if (rdtype != dns_rdatatype_opt && rdtype != dns_rdatatype_tsig && diff --git a/lib/dns/ncache.c b/lib/dns/ncache.c index 432862a19b..083f15c7b7 100644 --- a/lib/dns/ncache.c +++ b/lib/dns/ncache.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ncache.c,v 1.24 2001/01/09 21:51:08 bwelling Exp $ */ +/* $Id: ncache.c,v 1.25 2001/11/30 01:59:13 gson Exp $ */ #include @@ -244,7 +244,8 @@ dns_ncache_add(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node, ISC_LIST_APPEND(ncrdatalist.rdata, &rdata, link); dns_rdataset_init(&ncrdataset); - dns_rdatalist_tordataset(&ncrdatalist, &ncrdataset); + RUNTIME_CHECK(dns_rdatalist_tordataset(&ncrdatalist, &ncrdataset) + == ISC_R_SUCCESS); ncrdataset.trust = trust; return (dns_db_addrdataset(cache, node, NULL, now, &ncrdataset, diff --git a/lib/dns/peer.c b/lib/dns/peer.c index bddda125e1..1e589cf49d 100644 --- a/lib/dns/peer.c +++ b/lib/dns/peer.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: peer.c,v 1.16 2001/11/12 19:05:26 gson Exp $ */ +/* $Id: peer.c,v 1.17 2001/11/30 01:59:14 gson Exp $ */ #include @@ -38,11 +38,11 @@ #define REQUEST_IXFR_BIT 4 #define SUPPORT_EDNS_BIT 5 -static isc_result_t -dns_peerlist_delete(dns_peerlist_t **list); +static void +peerlist_delete(dns_peerlist_t **list); -static isc_result_t -dns_peer_delete(dns_peer_t **peer); +static void +peer_delete(dns_peer_t **peer); isc_result_t dns_peerlist_new(isc_mem_t *mem, dns_peerlist_t **list) { @@ -51,9 +51,8 @@ dns_peerlist_new(isc_mem_t *mem, dns_peerlist_t **list) { REQUIRE(list != NULL); l = isc_mem_get(mem, sizeof(*l)); - if (l == NULL) { + if (l == NULL) return (ISC_R_NOMEMORY); - } ISC_LIST_INIT(l->elements); l->mem = mem; @@ -94,16 +93,14 @@ dns_peerlist_detach(dns_peerlist_t **list) { plist->refs--; - if (plist->refs == 0) { - dns_peerlist_delete(&plist); - } + if (plist->refs == 0) + peerlist_delete(&plist); } -static isc_result_t -dns_peerlist_delete(dns_peerlist_t **list) { +static void +peerlist_delete(dns_peerlist_t **list) { dns_peerlist_t *l; dns_peer_t *server, *stmp; - isc_result_t r; REQUIRE(list != NULL); REQUIRE(DNS_PEERLIST_VALID(*list)); @@ -116,11 +113,7 @@ dns_peerlist_delete(dns_peerlist_t **list) { while (server != NULL) { stmp = ISC_LIST_NEXT(server, next); ISC_LIST_UNLINK(l->elements, server, next); - r = dns_peer_detach(&server); - if (r != ISC_R_SUCCESS) { - return (r); - } - + dns_peer_detach(&server); server = stmp; } @@ -128,8 +121,6 @@ dns_peerlist_delete(dns_peerlist_t **list) { isc_mem_put(l->mem, l, sizeof(*l)); *list = NULL; - - return (ISC_R_SUCCESS); } void @@ -153,9 +144,8 @@ dns_peerlist_peerbyaddr(dns_peerlist_t *servers, server = ISC_LIST_HEAD(servers->elements); while (server != NULL) { - if (isc_netaddr_equal(addr, &server->address)) { + if (isc_netaddr_equal(addr, &server->address)) break; - } server = ISC_LIST_NEXT(server, next); } @@ -190,9 +180,8 @@ dns_peer_new(isc_mem_t *mem, isc_netaddr_t *addr, dns_peer_t **peerptr) { REQUIRE(peerptr != NULL); peer = isc_mem_get(mem, sizeof(*peer)); - if (peer == NULL) { + if (peer == NULL) return (ISC_R_NOMEMORY); - } peer->magic = DNS_PEER_MAGIC; peer->address = *addr; @@ -214,7 +203,7 @@ dns_peer_new(isc_mem_t *mem, isc_netaddr_t *addr, dns_peer_t **peerptr) { return (ISC_R_SUCCESS); } -isc_result_t +void dns_peer_attach(dns_peer_t *source, dns_peer_t **target) { REQUIRE(DNS_PEER_VALID(source)); REQUIRE(target != NULL); @@ -225,11 +214,9 @@ dns_peer_attach(dns_peer_t *source, dns_peer_t **target) { ENSURE(source->refs != 0xffffffffU); *target = source; - - return (ISC_R_SUCCESS); } -isc_result_t +void dns_peer_detach(dns_peer_t **peer) { dns_peer_t *p; @@ -244,15 +231,12 @@ dns_peer_detach(dns_peer_t **peer) { *peer = NULL; p->refs--; - if (p->refs == 0) { - dns_peer_delete(&p); - } - - return (ISC_R_SUCCESS); + if (p->refs == 0) + peer_delete(&p); } -static isc_result_t -dns_peer_delete(dns_peer_t **peer) { +static void +peer_delete(dns_peer_t **peer) { dns_peer_t *p; isc_mem_t *mem; @@ -275,8 +259,6 @@ dns_peer_delete(dns_peer_t **peer) { isc_mem_put(mem, p, sizeof(*p)); *peer = NULL; - - return (ISC_R_SUCCESS); } isc_result_t diff --git a/lib/dns/rbt.c b/lib/dns/rbt.c index 07e624aeb0..0fab687c43 100644 --- a/lib/dns/rbt.c +++ b/lib/dns/rbt.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rbt.c,v 1.119 2001/11/27 00:55:56 gson Exp $ */ +/* $Id: rbt.c,v 1.120 2001/11/30 01:59:15 gson Exp $ */ /* Principal Authors: DCL */ @@ -2167,10 +2167,9 @@ dns_rbt_indent(int depth) { static void dns_rbt_printnodename(dns_rbtnode_t *node) { - isc_buffer_t target; isc_region_t r; dns_name_t name; - char buffer[1024]; + char buffer[DNS_NAME_FORMATSIZE]; dns_offsets_t offsets; r.length = NAMELEN(node); @@ -2179,14 +2178,9 @@ dns_rbt_printnodename(dns_rbtnode_t *node) { dns_name_init(&name, offsets); dns_name_fromregion(&name, &r); - isc_buffer_init(&target, buffer, 255); + dns_name_format(&name, buffer, sizeof(buffer)); - /* - * ISC_FALSE means absolute names have the final dot added. - */ - dns_name_totext(&name, ISC_FALSE, &target); - - printf("%.*s", (int)target.used, (char *)target.base); + printf("%s", buffer); } static void diff --git a/lib/dns/request.c b/lib/dns/request.c index bf6bba8366..4cf4b43442 100644 --- a/lib/dns/request.c +++ b/lib/dns/request.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: request.c,v 1.69 2001/11/12 19:05:29 gson Exp $ */ +/* $Id: request.c,v 1.70 2001/11/30 01:59:16 gson Exp $ */ #include @@ -885,8 +885,11 @@ dns_request_createvia2(dns_requestmgr_t *requestmgr, dns_message_t *message, goto cleanup; message->id = id; - if (setkey) - dns_message_settsigkey(message, request->tsigkey); + if (setkey) { + result = dns_message_settsigkey(message, request->tsigkey); + if (result != ISC_R_SUCCESS) + goto cleanup; + } result = req_render(message, &request->query, options, mctx); if (result == DNS_R_USETCP && (options & DNS_REQUESTOPT_TCP) == 0) { @@ -1078,7 +1081,7 @@ do_cancel(isc_task_t *task, isc_event_t *event) { UNLOCK(&request->requestmgr->locks[request->hash]); } -isc_result_t +void dns_request_cancel(dns_request_t *request) { REQUIRE(VALID_REQUEST(request)); @@ -1093,7 +1096,6 @@ dns_request_cancel(dns_request_t *request) { request->canceling = ISC_TRUE; } UNLOCK(&request->requestmgr->locks[request->hash]); - return (ISC_R_SUCCESS); } isc_result_t @@ -1108,8 +1110,12 @@ dns_request_getresponse(dns_request_t *request, dns_message_t *message, req_log(ISC_LOG_DEBUG(3), "dns_request_getresponse: request %p", request); - dns_message_setquerytsig(message, request->tsig); - dns_message_settsigkey(message, request->tsigkey); + result = dns_message_setquerytsig(message, request->tsig); + if (result != ISC_R_SUCCESS) + return (result); + result = dns_message_settsigkey(message, request->tsigkey); + if (result != ISC_R_SUCCESS) + return (result); result = dns_message_parse(message, request->answer, options); if (result != ISC_R_SUCCESS) return (result); diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 602a696a6a..72f77fc8f6 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: resolver.c,v 1.233 2001/11/14 22:05:05 gson Exp $ */ +/* $Id: resolver.c,v 1.234 2001/11/30 01:59:18 gson Exp $ */ #include @@ -643,7 +643,7 @@ fctx_addopt(dns_message_t *message) { ISC_LIST_INIT(rdatalist->rdata); ISC_LIST_APPEND(rdatalist->rdata, rdata, link); - dns_rdatalist_tordataset(rdatalist, rdataset); + RUNTIME_CHECK(dns_rdatalist_tordataset(rdatalist, rdataset) == ISC_R_SUCCESS); return (dns_message_setopt(message, rdataset)); } @@ -717,9 +717,7 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, * valid until this query is canceled. */ query->addrinfo = addrinfo; - result = isc_time_now(&query->start); - if (result != ISC_R_SUCCESS) - goto cleanup_query; + TIME_NOW(&query->start); /* * If this is a TCP query, then we need to make a socket and @@ -830,7 +828,7 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, isc_mem_put(res->mctx, query, sizeof(*query)); stop_idle_timer: - fctx_stopidletimer(fctx); + RUNTIME_CHECK(fctx_stopidletimer(fctx) == ISC_R_SUCCESS); return (result); } @@ -1016,8 +1014,10 @@ resquery_send(resquery_t *query) { goto cleanup_message; if (tsigkey != NULL) { - dns_message_settsigkey(fctx->qmessage, tsigkey); + result = dns_message_settsigkey(fctx->qmessage, tsigkey); dns_tsigkey_detach(&tsigkey); + if (result != ISC_R_SUCCESS) + goto cleanup_message; } result = dns_message_rendersection(fctx->qmessage, @@ -1470,17 +1470,18 @@ fctx_getaddresses(fetchctx_t *fctx) { restart: INSIST(ISC_LIST_EMPTY(fctx->finds)); - result = dns_rdataset_first(&fctx->nameservers); - while (result == ISC_R_SUCCESS) { + for (result = dns_rdataset_first(&fctx->nameservers); + result == ISC_R_SUCCESS; + result = dns_rdataset_next(&fctx->nameservers)) + { dns_rdataset_current(&fctx->nameservers, &rdata); /* * Extract the name from the NS record. */ result = dns_rdata_tostruct(&rdata, &ns, NULL); - if (result != ISC_R_SUCCESS) { - dns_rdataset_next(&fctx->nameservers); + if (result != ISC_R_SUCCESS) continue; - } + options = stdoptions; /* * If this name is a subdomain of the query domain, tell @@ -1555,7 +1556,6 @@ fctx_getaddresses(fetchctx_t *fctx) { } dns_rdata_reset(&rdata); dns_rdata_freestruct(&ns); - result = dns_rdataset_next(&fctx->nameservers); } if (result != ISC_R_NOMORE) return (result); @@ -1865,6 +1865,8 @@ fctx_timeout(isc_task_t *task, isc_event_t *event) { if (event->ev_type == ISC_TIMEREVENT_LIFE) { fctx_done(fctx, ISC_R_TIMEDOUT); } else { + isc_result_t result; + fctx->timeouts++; /* * We could cancel the running queries here, or we could let @@ -1875,11 +1877,14 @@ fctx_timeout(isc_task_t *task, isc_event_t *event) { * Our timer has triggered. Reestablish the fctx lifetime * timer. */ - fctx_starttimer(fctx); - /* - * Keep trying. - */ - fctx_try(fctx); + result = fctx_starttimer(fctx); + if (result != ISC_R_SUCCESS) + fctx_done(fctx, result); + else + /* + * Keep trying. + */ + fctx_try(fctx); } isc_event_free(&event); @@ -2036,11 +2041,16 @@ fctx_start(isc_task_t *task, isc_event_t *event) { UNLOCK(&res->buckets[bucketnum].lock); if (!done) { + isc_result_t result; + /* * All is well. Start working on the fetch. */ - fctx_starttimer(fctx); - fctx_try(fctx); + result = fctx_starttimer(fctx); + if (result != ISC_R_SUCCESS) + fctx_done(fctx, result); + else + fctx_try(fctx); } else if (bucket_empty) empty_bucket(res); } @@ -2679,8 +2689,9 @@ validated(isc_task_t *task, isc_event_t *event) { if (hevent != NULL) { hevent->result = eresult; - dns_name_copy(vevent->name, - dns_fixedname_name(&hevent->foundname), NULL); + RUNTIME_CHECK(dns_name_copy(vevent->name, + dns_fixedname_name(&hevent->foundname), NULL) + == ISC_R_SUCCESS); dns_db_attach(fctx->cache, &hevent->db); hevent->node = node; node = NULL; @@ -4032,7 +4043,7 @@ answer_response(fetchctx_t *fctx) { static void resquery_response(isc_task_t *task, isc_event_t *event) { - isc_result_t result; + isc_result_t result = ISC_R_SUCCESS; resquery_t *query = event->ev_arg; dns_dispatchevent_t *devent = (dns_dispatchevent_t *)event; isc_boolean_t keep_trying, broken_server, get_nameservers, resend; @@ -4076,9 +4087,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) { * need a routine to convert from an isc_time_t to an * isc_stdtime_t. */ - result = isc_time_now(&tnow); - if (result != ISC_R_SUCCESS) - goto done; + TIME_NOW(&tnow); finish = &tnow; isc_stdtime_get(&now); @@ -4322,8 +4331,14 @@ resquery_response(isc_task_t *task, isc_event_t *event) { if (fctx->res->lame_ttl != 0 && !ISFORWARDER(query->addrinfo) && is_lame(fctx)) { log_lame(fctx, query->addrinfo); - dns_adb_marklame(fctx->adb, query->addrinfo, - &fctx->domain, now + fctx->res->lame_ttl); + result = dns_adb_marklame(fctx->adb, query->addrinfo, + &fctx->domain, + now + fctx->res->lame_ttl); + if (result != ISC_R_SUCCESS) + isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER, + DNS_LOGMODULE_RESOLVER, ISC_LOG_ERROR, + "could not mark server as lame: %s", + isc_result_totext(result)); broken_server = ISC_TRUE; keep_trying = ISC_TRUE; goto done; diff --git a/lib/dns/sec/dst/dst_api.c b/lib/dns/sec/dst/dst_api.c index c7915cbd66..c56eb1d6b2 100644 --- a/lib/dns/sec/dst/dst_api.c +++ b/lib/dns/sec/dst/dst_api.c @@ -19,7 +19,7 @@ /* * Principal Author: Brian Wellington - * $Id: dst_api.c,v 1.96 2001/11/28 02:35:02 bwelling Exp $ + * $Id: dst_api.c,v 1.97 2001/11/30 01:59:29 gson Exp $ */ #include @@ -882,7 +882,7 @@ read_public_key(const char *filename, isc_mem_t *mctx, dst_key_t **keyp) { cleanup: if (lex != NULL) { - isc_lex_close(lex); + RUNTIME_CHECK(isc_lex_close(lex) == ISC_R_SUCCESS); isc_lex_destroy(&lex); } isc_mem_put(mctx, newfilename, newfilenamelen); diff --git a/lib/dns/sec/dst/dst_parse.c b/lib/dns/sec/dst/dst_parse.c index 891b39e378..cdbd8515f9 100644 --- a/lib/dns/sec/dst/dst_parse.c +++ b/lib/dns/sec/dst/dst_parse.c @@ -19,7 +19,7 @@ /* * Principal Author: Brian Wellington - * $Id: dst_parse.c,v 1.33 2001/09/15 00:27:26 bwelling Exp $ + * $Id: dst_parse.c,v 1.34 2001/11/30 01:59:30 gson Exp $ */ #include @@ -330,7 +330,7 @@ dst__privstruct_parsefile(dst_key_t *key, unsigned int alg, if (check_data(priv, alg) < 0) goto fail; - isc_lex_close(lex); + RUNTIME_CHECK(isc_lex_close(lex) == ISC_R_SUCCESS); isc_lex_destroy(&lex); isc_mem_put(mctx, newfilename, newfilenamelen); @@ -338,7 +338,7 @@ dst__privstruct_parsefile(dst_key_t *key, unsigned int alg, fail: if (lex != NULL) { - isc_lex_close(lex); + (void)isc_lex_close(lex); isc_lex_destroy(&lex); } isc_mem_put(mctx, newfilename, newfilenamelen); diff --git a/lib/dns/sec/dst/openssl_link.c b/lib/dns/sec/dst/openssl_link.c index 5085627101..4e20a187ed 100644 --- a/lib/dns/sec/dst/openssl_link.c +++ b/lib/dns/sec/dst/openssl_link.c @@ -19,7 +19,7 @@ /* * Principal Author: Brian Wellington - * $Id: openssl_link.c,v 1.48 2001/11/20 21:28:38 gson Exp $ + * $Id: openssl_link.c,v 1.49 2001/11/30 01:59:31 gson Exp $ */ #ifdef OPENSSL @@ -167,7 +167,7 @@ dst__openssl_init() { mem_free(rm); #endif cleanup_mutexinit: - RUNTIME_CHECK(isc_mutexblock_destroy(locks, nlocks) == ISC_R_SUCCESS); + DESTROYMUTEXBLOCK(locks, nlocks); cleanup_mutexalloc: mem_free(locks); return (result); @@ -181,8 +181,7 @@ dst__openssl_destroy() { ENGINE_free(e); #endif if (locks != NULL) { - RUNTIME_CHECK(isc_mutexblock_destroy(locks, nlocks) == - ISC_R_SUCCESS); + DESTROYMUTEXBLOCK(locks, nlocks); mem_free(locks); } if (rm != NULL) diff --git a/lib/dns/tkey.c b/lib/dns/tkey.c index e717f87da7..9a0fe14dd0 100644 --- a/lib/dns/tkey.c +++ b/lib/dns/tkey.c @@ -16,7 +16,7 @@ */ /* - * $Id: tkey.c,v 1.72 2001/10/09 17:26:33 bwelling Exp $ + * $Id: tkey.c,v 1.73 2001/11/30 01:59:19 gson Exp $ */ #include @@ -643,7 +643,8 @@ dns_tkey_processquery(dns_message_t *msg, dns_tkeyctx_t *tctx, if (!dns_name_equal(qname, dns_rootname)) { unsigned int n = dns_name_countlabels(qname); - dns_name_copy(qname, keyname, NULL); + RUNTIME_CHECK(dns_name_copy(qname, keyname, NULL) + == ISC_R_SUCCESS); dns_name_getlabelsequence(keyname, 0, n - 1, keyname); } else { diff --git a/lib/dns/tsig.c b/lib/dns/tsig.c index b1556d4c92..1acde4baa2 100644 --- a/lib/dns/tsig.c +++ b/lib/dns/tsig.c @@ -16,7 +16,7 @@ */ /* - * $Id: tsig.c,v 1.114 2001/11/19 03:08:12 mayer Exp $ + * $Id: tsig.c,v 1.115 2001/11/30 01:59:20 gson Exp $ */ #include @@ -146,7 +146,7 @@ dns_tsigkey_createfromkey(dns_name_t *name, dns_name_t *algorithm, ret = dns_name_dup(name, mctx, &tkey->name); if (ret != ISC_R_SUCCESS) goto cleanup_key; - dns_name_downcase(&tkey->name, &tkey->name, NULL); + (void)dns_name_downcase(&tkey->name, &tkey->name, NULL); if (dns_name_equal(algorithm, DNS_TSIG_HMACMD5_NAME)) { tkey->algorithm = DNS_TSIG_HMACMD5_NAME; @@ -180,7 +180,8 @@ dns_tsigkey_createfromkey(dns_name_t *name, dns_name_t *algorithm, ret = dns_name_dup(algorithm, mctx, tkey->algorithm); if (ret != ISC_R_SUCCESS) goto cleanup_algorithm; - dns_name_downcase(tkey->algorithm, tkey->algorithm, NULL); + (void)dns_name_downcase(tkey->algorithm, tkey->algorithm, + NULL); } if (creator != NULL) { @@ -597,7 +598,8 @@ dns_tsig_sign(dns_message_t *msg) { if (ret != ISC_R_SUCCESS) goto cleanup_owner; dns_rdataset_init(dataset); - dns_rdatalist_tordataset(datalist, dataset); + RUNTIME_CHECK(dns_rdatalist_tordataset(datalist, dataset) + == ISC_R_SUCCESS); msg->tsig = dataset; msg->tsigname = owner; diff --git a/lib/dns/validator.c b/lib/dns/validator.c index 69599a1453..b436d334dc 100644 --- a/lib/dns/validator.c +++ b/lib/dns/validator.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: validator.c,v 1.95 2001/11/12 19:05:35 gson Exp $ */ +/* $Id: validator.c,v 1.96 2001/11/30 01:59:21 gson Exp $ */ #include @@ -990,7 +990,9 @@ validate(dns_validator_t *val, isc_boolean_t resume) { sizeof(*val->siginfo)); if (val->siginfo == NULL) return (ISC_R_NOMEMORY); - dns_rdata_tostruct(&rdata, val->siginfo, NULL); + result = dns_rdata_tostruct(&rdata, val->siginfo, NULL); + if (result != ISC_R_SUCCESS) + return (result); /* * At this point we could check that the signature algorithm diff --git a/lib/dns/view.c b/lib/dns/view.c index 3d3ef70229..81e795a975 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: view.c,v 1.108 2001/11/27 04:06:14 marka Exp $ */ +/* $Id: view.c,v 1.109 2001/11/30 01:59:23 gson Exp $ */ #include @@ -343,7 +343,7 @@ dialup(dns_zone_t *zone, void *dummy) { void dns_view_dialup(dns_view_t *view) { REQUIRE(DNS_VIEW_VALID(view)); - dns_zt_apply(view->zonetable, ISC_FALSE, dialup, NULL); + (void)dns_zt_apply(view->zonetable, ISC_FALSE, dialup, NULL); } void diff --git a/lib/dns/xfrin.c b/lib/dns/xfrin.c index 75f98e6856..6e465db567 100644 --- a/lib/dns/xfrin.c +++ b/lib/dns/xfrin.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: xfrin.c,v 1.128 2001/09/27 01:01:46 gson Exp $ */ +/* $Id: xfrin.c,v 1.129 2001/11/30 01:59:24 gson Exp $ */ #include @@ -373,8 +373,11 @@ ixfr_apply(dns_xfrin_ctx_t *xfr) { CHECK(dns_journal_begin_transaction(xfr->ixfr.journal)); } CHECK(dns_diff_apply(&xfr->diff, xfr->db, xfr->ver)); - if (xfr->ixfr.journal != NULL) - dns_journal_writediff(xfr->ixfr.journal, &xfr->diff); + if (xfr->ixfr.journal != NULL) { + result = dns_journal_writediff(xfr->ixfr.journal, &xfr->diff); + if (result != ISC_R_SUCCESS) + goto failure; + } dns_diff_clear(&xfr->diff); xfr->difflen = 0; result = ISC_R_SUCCESS; @@ -1080,8 +1083,8 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) { CHECK(dns_message_create(xfr->mctx, DNS_MESSAGE_INTENTPARSE, &msg)); - dns_message_settsigkey(msg, xfr->tsigkey); - dns_message_setquerytsig(msg, xfr->lasttsig); + CHECK(dns_message_settsigkey(msg, xfr->tsigkey)); + CHECK(dns_message_setquerytsig(msg, xfr->lasttsig)); msg->tsigctx = xfr->tsigctx; if (xfr->nmsg > 0) msg->tcp_continuation = 1; @@ -1105,7 +1108,7 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) { xfrin_reset(xfr); xfr->reqtype = dns_rdatatype_axfr; xfr->state = XFRST_INITIALSOA; - xfrin_start(xfr); + (void)xfrin_start(xfr); return; } diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 017afe386a..b137da87c9 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zone.c,v 1.353 2001/11/20 01:15:01 gson Exp $ */ +/* $Id: zone.c,v 1.354 2001/11/30 01:59:25 gson Exp $ */ #include @@ -590,8 +590,10 @@ zone_free(dns_zone_t *zone) { if (zone->db != NULL) dns_db_detach(&zone->db); zone_freedbargs(zone); - dns_zone_setmasterswithkeys(zone, NULL, NULL, 0); - dns_zone_setalsonotify(zone, NULL, 0); + RUNTIME_CHECK(dns_zone_setmasterswithkeys(zone, NULL, NULL, 0) + == ISC_R_SUCCESS); + RUNTIME_CHECK(dns_zone_setalsonotify(zone, NULL, 0) + == ISC_R_SUCCESS); zone->check_names = dns_severity_ignore; if (zone->update_acl != NULL) dns_acl_detach(&zone->update_acl); @@ -893,7 +895,7 @@ zone_load(dns_zone_t *zone, unsigned int flags) { REQUIRE(DNS_ZONE_VALID(zone)); LOCK_ZONE(zone); - isc_time_now(&now); + TIME_NOW(&now); INSIST(zone->type != dns_zone_none); @@ -961,9 +963,7 @@ zone_load(dns_zone_t *zone, unsigned int flags) { * zone->loadtime is set, then the file will still be reloaded * the next time dns_zone_load is called. */ - result = isc_time_now(&loadtime); - if (result != ISC_R_SUCCESS) - goto cleanup; + TIME_NOW(&loadtime); INSIST(zone->db_argc >= 1); result = dns_db_create(zone->mctx, zone->db_argv[0], @@ -1161,7 +1161,7 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime, isc_time_t now; isc_boolean_t needdump = ISC_FALSE; - isc_time_now(&now); + TIME_NOW(&now); /* * Initiate zone transfer? We may need a error code that @@ -1921,7 +1921,7 @@ dns_zone_maintenance(dns_zone_t *zone) { ENTER; LOCK_ZONE(zone); - isc_time_now(&now); + TIME_NOW(&now); zone_settimer(zone, &now); UNLOCK_ZONE(zone); } @@ -1961,7 +1961,7 @@ zone_maintenance(dns_zone_t *zone) { if (zone->view == NULL || zone->view->adb == NULL) return; - isc_time_now(&now); + TIME_NOW(&now); /* * Expire check. @@ -2180,7 +2180,7 @@ zone_needdump(dns_zone_t *zone, unsigned int delay) { return; isc_interval_set(&i, delay, 0); - isc_time_now(&now); + TIME_NOW(&now); isc_time_add(&now, &i, &dumptime); /* add some noise */ @@ -2732,7 +2732,7 @@ dns_zone_notify(dns_zone_t *zone) { LOCK_ZONE(zone); DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NEEDNOTIFY); - isc_time_now(&now); + TIME_NOW(&now); zone_settimer(zone, &now); UNLOCK_ZONE(zone); } @@ -3037,7 +3037,7 @@ stub_callback(isc_task_t *task, isc_event_t *event) { ENTER; - isc_time_now(&now); + TIME_NOW(&now); if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING)) { zone_debuglog(zone, me, 1, "exiting"); @@ -3149,7 +3149,7 @@ stub_callback(isc_task_t *task, isc_event_t *event) { if (zone->masterfile != NULL) { dns_zone_dump(zone); - (void)isc_time_now(&zone->loadtime); + TIME_NOW(&zone->loadtime); } dns_message_destroy(&msg); @@ -3242,7 +3242,7 @@ refresh_callback(isc_task_t *task, isc_event_t *event) { isc_sockaddr_format(&zone->masteraddr, master, sizeof(master)); - isc_time_now(&now); + TIME_NOW(&now); if (revent->result != ISC_R_SUCCESS) { if (revent->result == ISC_R_TIMEDOUT && @@ -3986,7 +3986,7 @@ cancel_refresh(dns_zone_t *zone) { ENTER; DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_REFRESH); - isc_time_now(&now); + TIME_NOW(&now); zone_settimer(zone, &now); } @@ -4774,7 +4774,7 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) { * fails for some reason, all that happens is * the timestamp is not updated. */ - (void)isc_time_now(&zone->loadtime); + TIME_NOW(&zone->loadtime); } if (dump && zone->journal != NULL) { @@ -4832,7 +4832,7 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) { INSIST((zone->flags & DNS_ZONEFLG_REFRESH) != 0); DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_REFRESH); - isc_time_now(&now); + TIME_NOW(&now); switch (result) { case ISC_R_SUCCESS: DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NEEDNOTIFY); diff --git a/lib/isc/entropy.c b/lib/isc/entropy.c index f9d57cc4d2..bf7a484d23 100644 --- a/lib/isc/entropy.c +++ b/lib/isc/entropy.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: entropy.c,v 1.7 2001/11/27 01:55:55 gson Exp $ */ +/* $Id: entropy.c,v 1.8 2001/11/30 01:59:32 gson Exp $ */ /* * This is the system independent part of the entropy module. It is @@ -347,7 +347,6 @@ entropypool_adddata(isc_entropy_t *ent, void *p, unsigned int len, static inline void reseed(isc_entropy_t *ent) { - isc_result_t result; isc_time_t t; pid_t pid; @@ -367,11 +366,9 @@ reseed(isc_entropy_t *ent) { if ((ent->initcount % 50) != 0) return; - result = isc_time_now(&t); - if (result == ISC_R_SUCCESS) { - entropypool_adddata(ent, &t, sizeof(t), 0); - ent->initcount++; - } + TIME_NOW(&t); + entropypool_adddata(ent, &t, sizeof(t), 0); + ent->initcount++; } static inline unsigned int @@ -1176,9 +1173,7 @@ kbdget(isc_entropysource_t *source, void *arg, isc_boolean_t blocking) { if (result != ISC_R_SUCCESS) return (result); - result = isc_time_now(&t); - if (result != ISC_R_SUCCESS) - return (result); + TIME_NOW(&t); sample = isc_time_nanoseconds(&t); extra = c; diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h index 1b5d5ee73d..6144e11ba8 100644 --- a/lib/isc/include/isc/util.h +++ b/lib/isc/include/isc/util.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: util.h,v 1.22 2001/11/20 21:28:34 gson Exp $ */ +/* $Id: util.h,v 1.23 2001/11/30 01:59:38 gson Exp $ */ #ifndef ISC_UTIL_H #define ISC_UTIL_H 1 @@ -172,6 +172,9 @@ RUNTIME_CHECK(isc_rwlock_unlock((lp), (t)) == ISC_R_SUCCESS); \ } while (0) +#define DESTROYMUTEXBLOCK(bp, n) \ + RUNTIME_CHECK(isc_mutexblock_destroy((bp), (n)) == ISC_R_SUCCESS) + /* * List Macros. */ @@ -214,4 +217,9 @@ #define FATAL_ERROR isc_error_fatal #define RUNTIME_CHECK(cond) ISC_ERROR_RUNTIMECHECK(cond) +/* + * Time + */ +#define TIME_NOW(tp) RUNTIME_CHECK(isc_time_now((tp)) == ISC_R_SUCCESS) + #endif /* ISC_UTIL_H */ diff --git a/lib/isc/lex.c b/lib/isc/lex.c index b7349fbf45..5e804331ac 100644 --- a/lib/isc/lex.c +++ b/lib/isc/lex.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lex.c,v 1.70 2001/11/30 01:02:13 gson Exp $ */ +/* $Id: lex.c,v 1.71 2001/11/30 01:59:33 gson Exp $ */ #include @@ -132,7 +132,7 @@ isc_lex_destroy(isc_lex_t **lexp) { REQUIRE(VALID_LEX(lex)); while (!EMPTY(lex->sources)) - isc_lex_close(lex); + RUNTIME_CHECK(isc_lex_close(lex) == ISC_R_SUCCESS); if (lex->data != NULL) isc_mem_put(lex->mctx, lex->data, lex->max_token + 1); lex->magic = 0; @@ -238,7 +238,7 @@ isc_lex_openfile(isc_lex_t *lex, const char *filename) { result = new_source(lex, ISC_TRUE, ISC_TRUE, stream, filename); if (result != ISC_R_SUCCESS) - fclose(stream); + (void)fclose(stream); return (result); } @@ -291,7 +291,7 @@ isc_lex_close(isc_lex_t *lex) { ISC_LIST_UNLINK(lex->sources, source, link); if (source->is_file) { if (source->need_close) - fclose((FILE *)(source->input)); + (void)fclose((FILE *)(source->input)); } isc_mem_free(lex->mctx, source->name); isc_buffer_free(&source->pushback); diff --git a/lib/isc/log.c b/lib/isc/log.c index 878d4fb654..b10000d2b2 100644 --- a/lib/isc/log.c +++ b/lib/isc/log.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: log.c,v 1.71 2001/08/31 21:51:24 gson Exp $ */ +/* $Id: log.c,v 1.72 2001/11/30 01:59:34 gson Exp $ */ /* Principal Authors: DCL */ @@ -1003,7 +1003,7 @@ isc_log_gettag(isc_logconfig_t *lcfg) { /* XXXDCL NT -- This interface will assuredly be changing. */ void isc_log_opensyslog(const char *tag, int options, int facility) { - openlog(tag, options, facility); + (void)openlog(tag, options, facility); } void @@ -1437,22 +1437,11 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, if ((channel->flags & ISC_LOG_PRINTTIME) != 0 && time_string[0] == '\0') { - isc_time_t isctime; - - result = isc_time_now(&isctime); - if (result == ISC_R_SUCCESS) - isc_time_formattimestamp(&isctime, time_string, - sizeof(time_string)); - else - /* - * "Should never happen." - */ - snprintf(time_string, sizeof(time_string), - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_LOG, - ISC_MSG_BADTIME, - "Bad 00 99:99:99.999")); - + isc_time_t isctime; + + TIME_NOW(&isctime); + isc_time_formattimestamp(&isctime, time_string, + sizeof(time_string)); } if ((channel->flags & ISC_LOG_PRINTLEVEL) != 0 && @@ -1495,10 +1484,9 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, * which fall within the duplicate_interval * range. */ - if (isc_time_now(&oldest) != ISC_R_SUCCESS || - isc_time_subtract(&oldest, &interval, - &oldest) != - ISC_R_SUCCESS) + TIME_NOW(&oldest); + if (isc_time_subtract(&oldest, &interval, &oldest) + != ISC_R_SUCCESS) /* * Can't effectively do the checking * without having a valid time. @@ -1570,16 +1558,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, new->text = (char *)(new + 1); strcpy(new->text, lctx->buffer); - if (isc_time_now(&new->time) != - ISC_R_SUCCESS) - /* - * This will cause the message - * to immediately expire on - * the next call to [v]write1. - * What's a fella to do if - * getting the time fails? - */ - isc_time_settoepoch(&new->time); + TIME_NOW(&new->time); ISC_LIST_APPEND(lctx->messages, new, link); @@ -1615,7 +1594,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, (stat(FILE_NAME(channel), &statbuf) != 0 && errno == ENOENT) || statbuf.st_size < FILE_MAXSIZE(channel)) { - fclose(FILE_STREAM(channel)); + (void)fclose(FILE_STREAM(channel)); FILE_STREAM(channel) = NULL; FILE_MAXREACHED(channel) = ISC_FALSE; } else @@ -1679,7 +1658,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category, else syslog_level = syslog_map[-level]; - syslog(FACILITY(channel) | syslog_level, + (void)syslog(FACILITY(channel) | syslog_level, "%s%s%s%s%s%s%s%s%s", printtime ? time_string : "", printtag ? lcfg->tag : "", diff --git a/lib/isc/nls/msgcat.c b/lib/isc/nls/msgcat.c index 836635fad0..6360edfa35 100644 --- a/lib/isc/nls/msgcat.c +++ b/lib/isc/nls/msgcat.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: msgcat.c,v 1.11 2001/11/27 01:56:12 gson Exp $ */ +/* $Id: msgcat.c,v 1.12 2001/11/30 01:59:39 gson Exp $ */ /* * Principal Author: Bob Halley @@ -96,7 +96,7 @@ isc_msgcat_close(isc_msgcat_t **msgcatp) { if (msgcat != NULL) { #ifdef HAVE_CATGETS if (msgcat->catalog != (nl_catd)(-1)) - catclose(msgcat->catalog); + (void)catclose(msgcat->catalog); #endif msgcat->magic = 0; free(msgcat); diff --git a/lib/isc/timer.c b/lib/isc/timer.c index f1819a7412..b6f4a95012 100644 --- a/lib/isc/timer.c +++ b/lib/isc/timer.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: timer.c,v 1.66 2001/11/27 01:56:11 gson Exp $ */ +/* $Id: timer.c,v 1.67 2001/11/30 01:59:36 gson Exp $ */ #include @@ -233,11 +233,11 @@ destroy(isc_timer_t *timer) { LOCK(&manager->lock); - isc_task_purgerange(timer->task, - timer, - ISC_TIMEREVENT_FIRSTEVENT, - ISC_TIMEREVENT_LASTEVENT, - NULL); + (void)isc_task_purgerange(timer->task, + timer, + ISC_TIMEREVENT_FIRSTEVENT, + ISC_TIMEREVENT_LASTEVENT, + NULL); deschedule(timer); UNLINK(manager->timers, timer, link); @@ -284,17 +284,7 @@ isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type, * Get current time. */ if (type != isc_timertype_inactive) { - result = isc_time_now(&now); - if (result != ISC_R_SUCCESS) { - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_time_now() %s: %s", - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - isc_result_totext(result)); - return (ISC_R_UNEXPECTED); - } + TIME_NOW(&now); } else { /* * We don't have to do this, but it keeps the compiler from @@ -409,17 +399,7 @@ isc_timer_reset(isc_timer_t *timer, isc_timertype_t type, * Get current time. */ if (type != isc_timertype_inactive) { - result = isc_time_now(&now); - if (result != ISC_R_SUCCESS) { - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_time_now() %s: %s", - isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, - "failed"), - isc_result_totext(result)); - return (ISC_R_UNEXPECTED); - } + TIME_NOW(&now); } else { /* * We don't have to do this, but it keeps the compiler from @@ -435,11 +415,11 @@ isc_timer_reset(isc_timer_t *timer, isc_timertype_t type, LOCK(&timer->lock); if (purge) - isc_task_purgerange(timer->task, - timer, - ISC_TIMEREVENT_FIRSTEVENT, - ISC_TIMEREVENT_LASTEVENT, - NULL); + (void)isc_task_purgerange(timer->task, + timer, + ISC_TIMEREVENT_FIRSTEVENT, + ISC_TIMEREVENT_LASTEVENT, + NULL); timer->type = type; timer->expires = *expires; timer->interval = *interval; @@ -486,16 +466,8 @@ isc_timer_touch(isc_timer_t *timer) { * don't want to do. */ - result = isc_time_now(&now); - if (result != ISC_R_SUCCESS) { - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_time_now() %s: %s", - isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, - ISC_MSG_FAILED, "failed"), - isc_result_totext(result)); - result = ISC_R_UNEXPECTED; - } else - result = isc_time_add(&now, &timer->interval, &timer->idle); + TIME_NOW(&now); + result = isc_time_add(&now, &timer->interval, &timer->idle); UNLOCK(&timer->lock); @@ -661,7 +633,7 @@ run(void *uap) { LOCK(&manager->lock); while (!manager->done) { - RUNTIME_CHECK(isc_time_now(&now) == ISC_R_SUCCESS); + TIME_NOW(&now); XTRACETIME(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, ISC_MSG_RUNNING, @@ -871,13 +843,12 @@ isc__timermgr_nextevent(isc_time_t *when) { return (ISC_R_SUCCESS); } -isc_result_t +void isc__timermgr_dispatch(void) { isc_time_t now; if (timermgr == NULL) - return (ISC_R_NOTFOUND); - isc_time_now(&now); + return; + TIME_NOW(&now); dispatch(timermgr, &now); - return (ISC_R_SUCCESS); } #endif /* ISC_PLATFORM_USETHREADS */ diff --git a/lib/isc/timer_p.h b/lib/isc/timer_p.h index 6b95361536..6b32c39ada 100644 --- a/lib/isc/timer_p.h +++ b/lib/isc/timer_p.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: timer_p.h,v 1.4 2001/01/09 21:56:37 bwelling Exp $ */ +/* $Id: timer_p.h,v 1.5 2001/11/30 01:59:37 gson Exp $ */ #ifndef ISC_TIMER_P_H #define ISC_TIMER_P_H @@ -23,7 +23,7 @@ isc_result_t isc__timermgr_nextevent(isc_time_t *when); -isc_result_t +void isc__timermgr_dispatch(void); #endif /* ISC_TIMER_P_H */ diff --git a/lib/isc/unix/app.c b/lib/isc/unix/app.c index d343a5bb56..a6ca208113 100644 --- a/lib/isc/unix/app.c +++ b/lib/isc/unix/app.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: app.c,v 1.46 2001/11/27 01:56:13 gson Exp $ */ +/* $Id: app.c,v 1.47 2001/11/30 01:59:40 gson Exp $ */ #include @@ -316,7 +316,7 @@ evloop() { else { isc_uint64_t us; - (void)isc_time_now(&now); + TIME_NOW(&now); us = isc_time_microdiff(&when, &now); tv.tv_sec = us / 1000000; tv.tv_usec = us % 1000000; @@ -327,7 +327,7 @@ evloop() { isc__socketmgr_getfdsets(&readfds, &writefds, &maxfd); n = select(maxfd, &readfds, &writefds, NULL, tvp); - (void)isc__timermgr_dispatch(); + isc__timermgr_dispatch(); if (n > 0) (void)isc__socketmgr_dispatch(&readfds, &writefds, maxfd); diff --git a/lib/isc/unix/entropy.c b/lib/isc/unix/entropy.c index 6f7fcd8fc6..769431eb89 100644 --- a/lib/isc/unix/entropy.c +++ b/lib/isc/unix/entropy.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: entropy.c,v 1.62 2001/11/27 00:56:17 gson Exp $ */ +/* $Id: entropy.c,v 1.63 2001/11/30 01:59:41 gson Exp $ */ /* * This is the system depenedent part of the ISC entropy API. @@ -68,12 +68,12 @@ get_from_filesource(isc_entropysource_t *source, isc_uint32_t desired) { if (n < 0) { if (errno == EAGAIN || errno == EINTR) goto out; - close(fd); + (void)close(fd); source->bad = ISC_TRUE; goto out; } if (n == 0) { - close(fd); + (void)close(fd); source->bad = ISC_TRUE; goto out; } @@ -258,7 +258,7 @@ wait_for_sources(isc_entropy_t *ent) { static void destroyfilesource(isc_entropyfilesource_t *source) { - close(source->handle); + (void)close(source->handle); } /* @@ -336,7 +336,7 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) { return (ISC_R_SUCCESS); closefd: - close(fd); + (void)close(fd); errout: if (source != NULL) diff --git a/lib/isc/unix/file.c b/lib/isc/unix/file.c index d0413371f8..c5d4e755a6 100644 --- a/lib/isc/unix/file.c +++ b/lib/isc/unix/file.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: file.c,v 1.41 2001/09/20 21:21:49 gson Exp $ */ +/* $Id: file.c,v 1.42 2001/11/30 01:59:42 gson Exp $ */ #include @@ -178,7 +178,7 @@ isc_file_renameunique(const char *file, char *templet) { } } if (fd != -1) - close(fd); + (void)close(fd); return (result); } diff --git a/lib/isc/unix/keyboard.c b/lib/isc/unix/keyboard.c index 009d0d61f2..5fd7aa7734 100644 --- a/lib/isc/unix/keyboard.c +++ b/lib/isc/unix/keyboard.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: keyboard.c,v 1.9 2001/01/09 21:58:24 bwelling Exp $ */ +/* $Id: keyboard.c,v 1.10 2001/11/30 01:59:44 gson Exp $ */ #include @@ -87,7 +87,7 @@ isc_keyboard_close(isc_keyboard_t *keyboard, unsigned int sleeptime) { (void)sleep(sleeptime); (void)tcsetattr(keyboard->fd, TCSAFLUSH, &keyboard->saved_mode); - close(keyboard->fd); + (void)close(keyboard->fd); keyboard->fd = -1; diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c index 9395d8ed17..bb86eae9ec 100644 --- a/lib/isc/unix/net.c +++ b/lib/isc/unix/net.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: net.c,v 1.24 2001/11/01 23:20:21 gson Exp $ */ +/* $Id: net.c,v 1.25 2001/11/30 01:59:45 gson Exp $ */ #include @@ -118,7 +118,7 @@ try_proto(int domain) { #endif #endif - close(s); + (void)close(s); return (result); } diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 20011f7340..eebfa93848 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket.c,v 1.216 2001/11/29 07:31:22 marka Exp $ */ +/* $Id: socket.c,v 1.217 2001/11/30 01:59:46 gson Exp $ */ #include @@ -344,7 +344,7 @@ wakeup_socket(isc_socketmgr_t *manager, int fd, int msg) { manager->fdstate[fd] = CLOSED; FD_CLR(fd, &manager->read_fds); FD_CLR(fd, &manager->write_fds); - close(fd); + (void)close(fd); return; } if (manager->fdstate[fd] != MANAGED) @@ -1804,7 +1804,7 @@ internal_accept(isc_task_t *me, isc_event_t *ev) { UNLOCK(&sock->lock); if (fd != -1 && (make_nonblock(fd) != ISC_R_SUCCESS)) { - close(fd); + (void)close(fd); fd = -1; result = ISC_R_UNEXPECTED; } @@ -2002,7 +2002,7 @@ process_fds(isc_socketmgr_t *manager, int maxfd, FD_CLR(i, &manager->read_fds); FD_CLR(i, &manager->write_fds); - close(i); + (void)close(i); continue; } @@ -2252,8 +2252,8 @@ isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) { "isc_thread_create() %s", isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL, ISC_MSG_FAILED, "failed")); - close(manager->pipe_fds[0]); - close(manager->pipe_fds[1]); + (void)close(manager->pipe_fds[0]); + (void)close(manager->pipe_fds[1]); return (ISC_R_UNEXPECTED); } #endif /* ISC_PLATFORM_USETHREADS */ @@ -2339,14 +2339,14 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp) { * Clean up. */ #ifdef ISC_PLATFORM_USETHREADS - close(manager->pipe_fds[0]); - close(manager->pipe_fds[1]); + (void)close(manager->pipe_fds[0]); + (void)close(manager->pipe_fds[1]); (void)isc_condition_destroy(&manager->shutdown_ok); #endif /* ISC_PLATFORM_USETHREADS */ for (i = 0; i < FD_SETSIZE; i++) if (manager->fdstate[i] == CLOSE_PENDING) - close(i); + (void)close(i); DESTROYLOCK(&manager->lock); manager->magic = 0; diff --git a/lib/isc/unix/stdtime.c b/lib/isc/unix/stdtime.c index 56efc41f8d..f273d72b5f 100644 --- a/lib/isc/unix/stdtime.c +++ b/lib/isc/unix/stdtime.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: stdtime.c,v 1.12 2001/10/30 02:39:33 marka Exp $ */ +/* $Id: stdtime.c,v 1.13 2001/11/30 01:59:47 gson Exp $ */ #include @@ -55,7 +55,7 @@ fix_tv_usec(struct timeval *tv) { * Call syslog directly as we are called from the logging functions. */ if (fixed) - syslog(LOG_ERR, "gettimeofday returned bad tv_usec: corrected"); + (void)syslog(LOG_ERR, "gettimeofday returned bad tv_usec: corrected"); } #endif diff --git a/lib/isc/unix/time.c b/lib/isc/unix/time.c index 299f48dd51..6a0f2e9323 100644 --- a/lib/isc/unix/time.c +++ b/lib/isc/unix/time.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: time.c,v 1.42 2001/09/20 06:50:34 marka Exp $ */ +/* $Id: time.c,v 1.43 2001/11/30 01:59:48 gson Exp $ */ #include @@ -77,7 +77,7 @@ fix_tv_usec(struct timeval *tv) { * Call syslog directly as was are called from the logging functions. */ if (fixed) - syslog(LOG_ERR, "gettimeofday returned bad tv_usec: corrected"); + (void)syslog(LOG_ERR, "gettimeofday returned bad tv_usec: corrected"); } #endif diff --git a/lib/lwres/context.c b/lib/lwres/context.c index c9a4e02f61..7e38cf52e0 100644 --- a/lib/lwres/context.c +++ b/lib/lwres/context.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: context.c,v 1.42 2001/11/19 03:08:40 mayer Exp $ */ +/* $Id: context.c,v 1.43 2001/11/30 01:59:49 gson Exp $ */ #include @@ -128,7 +128,7 @@ lwres_context_destroy(lwres_context_t **contextp) { *contextp = NULL; if (ctx->sock != -1) { - close(ctx->sock); + (void)close(ctx->sock); ctx->sock = -1; } @@ -237,7 +237,7 @@ context_connect(lwres_context_t *ctx) { ret = connect(s, sa, salen); if (ret != 0) { - close(s); + (void)close(s); return (LWRES_R_IOERROR); }