]> The Tcpdump Group git mirrors - libpcap/commitdiff
DAG: Fix a condition
authorFrancois-Xavier Le Bail <[email protected]>
Wed, 17 Jun 2020 15:11:53 +0000 (17:11 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Wed, 17 Jun 2020 15:12:20 +0000 (17:12 +0200)
Found with cppcheck.

The warning was:
pcap-dag.c:1117:6: style: Suspicious condition (assignment + comparison);
Clarify expression with parentheses. [clarifyCondition]
  if ((dag_error = dag_config_get_uint32_attribute_ex(pd->dag_ref,
       pd->drop_attr, &stream_drop) == kDagErrNone)) {
     ^

pcap-dag.c

index 928088feedc1475e2e9ec7988d597a527591fa66..62f6e649351f649d7cf575dc93dee311fd7cb32c 100644 (file)
@@ -1114,7 +1114,7 @@ dag_stats(pcap_t *p, struct pcap_stat *ps) {
                /* Note this counter is cleared at start of capture and will wrap at UINT_MAX.
                 * The application is responsible for polling ps_drop frequently enough
                 * to detect each wrap and integrate total drop with a wider counter */
-               if ((dag_error = dag_config_get_uint32_attribute_ex(pd->dag_ref, pd->drop_attr, &stream_drop) == kDagErrNone)) {
+               if ((dag_error = dag_config_get_uint32_attribute_ex(pd->dag_ref, pd->drop_attr, &stream_drop)) == kDagErrNone) {
                        pd->stat.ps_drop = stream_drop;
                } else {
                        snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "reading stream drop attribute: %s",