]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix 'Dead nested assignment's from scan-build-10
authorOndřej Surý <ondrej@isc.org>
Wed, 25 Mar 2020 16:00:07 +0000 (17:00 +0100)
committerOndřej Surý <ondrej@isc.org>
Wed, 25 Mar 2020 16:33:07 +0000 (17:33 +0100)
The 3 warnings reported are:

os.c:872:7: warning: Although the value stored to 'ptr' is used in the enclosing expression, the value is never actually read from 'ptr'
        if ((ptr = strtok_r(command, " \t", &last)) == NULL) {
             ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

--

rpz.c:1117:10: warning: Although the value stored to 'zbits' is used in the enclosing expression, the value is never actually read from 'zbits'
        return (zbits &= x);
                ^        ~
1 warning generated.

--

openssleddsa_link.c:532:10: warning: Although the value stored to 'err' is used in the enclosing expression, the value is never actually read from 'err'
        while ((err = ERR_get_error()) != 0) {
                ^     ~~~~~~~~~~~~~~~
1 warning generated.

bin/named/unix/os.c
lib/dns/openssleddsa_link.c
lib/dns/rpz.c

index 54f0a694bf6d0e6ff359fcae91e8cde0cfaa211c..b99b0d3d001e8c941a566e01304083b8d689301a 100644 (file)
@@ -869,7 +869,7 @@ named_os_shutdownmsg(char *command, isc_buffer_t *text) {
        pid_t pid;
 
        /* Skip the command name. */
-       if ((ptr = strtok_r(command, " \t", &last)) == NULL) {
+       if (strtok_r(command, " \t", &last) == NULL) {
                return;
        }
 
index 19c52670af1262bcd5e82264a986dbe93cf0f096..326cf67c7e099ce70ec9121df715f2524574e4d5 100644 (file)
@@ -518,7 +518,6 @@ static bool
 openssleddsa_isprivate(const dst_key_t *key) {
        EVP_PKEY *pkey = key->keydata.pkey;
        int len;
-       unsigned long err;
 
        if (pkey == NULL) {
                return (false);
@@ -529,7 +528,7 @@ openssleddsa_isprivate(const dst_key_t *key) {
                return (true);
        }
        /* can check if first error is EC_R_INVALID_PRIVATE_KEY */
-       while ((err = ERR_get_error()) != 0) {
+       while (ERR_get_error() != 0) {
                /**/
        }
 
index a2f2e4b7ea53aeccb1ec668d8bc8e0b1f672b1bc..a16b760ee4427fdb409665477e2166ab3bc8d54f 100644 (file)
@@ -1114,7 +1114,8 @@ trim_zbits(dns_rpz_zbits_t zbits, dns_rpz_zbits_t found) {
        x = zbits & found;
        x &= (~x + 1);
        x = (x << 1) - 1;
-       return (zbits &= x);
+       zbits &= x;
+       return (zbits);
 }
 
 /*