2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Various little fixes found by coccinelle

The coccinellery repository provides many little semantic patches to fix common
problems in the code.  The number of semantic patches in the coccinellery
repository is high and most of the semantic patches apply only for Linux, so it
doesn't make sense to run them on regular basis as the processing takes a lot of
time.

The list of issue found in BIND 9, by no means complete, includes:

- double assignment to a variable
- `continue` at the end of the loop
- double checks for `NULL`
- useless checks for `NULL` (cannot be `NULL`, because of earlier return)
- using `0` instead of `NULL`
- useless extra condition (`if (foo) return; if (!foo) { ...; }`)
- removing & in front of static functions passed as arguments
This commit is contained in:
Ondřej Surý
2019-09-09 14:05:31 +02:00
parent c2e8a111f5
commit 288f5a4b52
24 changed files with 59 additions and 98 deletions

View File

@@ -142,7 +142,7 @@ fuzz_thread_client(void *arg) {
* Read the reply message from named to unclog it. Don't
* bother if there isn't a reply.
*/
recvfrom(sockfd, buf, 65536, MSG_DONTWAIT, NULL, NULL);
(void)recvfrom(sockfd, buf, 65536, MSG_DONTWAIT, NULL, NULL);
while (!ready)
pthread_cond_wait(&cond, &mutex);
@@ -412,8 +412,8 @@ fuzz_thread_resolver(void *arg) {
* Flush any pending data on the authoritative server.
*/
socklen = sizeof(recvaddr);
sent = recvfrom(listenfd, rbuf, 65536, MSG_DONTWAIT,
(struct sockaddr *) &recvaddr, &socklen);
(void)recvfrom(listenfd, rbuf, 65536, MSG_DONTWAIT,
(struct sockaddr *) &recvaddr, &socklen);
/*
* Send a fixed client query to named(resolver) of
@@ -511,7 +511,8 @@ fuzz_thread_resolver(void *arg) {
* to the client(query driver), so we're
* done.
*/
recvfrom(sockfd, buf, 65536, 0, NULL, NULL);
(void)recvfrom(sockfd, buf, 65536, 0, NULL,
NULL);
break;
}