From 38effe887ee979f91ad5abf42a2291558e7ff8d1 Mon Sep 17 00:00:00 2001 From: Justin Hibbits Date: Mon, 18 Nov 2019 23:23:38 +0000 Subject: [PATCH] bsnmp: Fix operator precedence in error check in table_check_response Summary: The ?: operator has a lower precedence than == and &&, so the result will always be recorded as true. Found by gcc8. Reviewed by: ngie, ae Differential Revision: https://reviews.freebsd.org/D22427 --- contrib/bsnmp/lib/snmpclient.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/bsnmp/lib/snmpclient.c b/contrib/bsnmp/lib/snmpclient.c index 285ffdb4c1b0..a42f94a4b55f 100644 --- a/contrib/bsnmp/lib/snmpclient.c +++ b/contrib/bsnmp/lib/snmpclient.c @@ -480,7 +480,7 @@ table_check_response(struct tabwork *work, const struct snmp_pdu *resp) if (snmp_client.version == SNMP_V1 && resp->error_status == SNMP_ERR_NOSUCHNAME && resp->error_index == - (work->descr->last_change.len == 0) ? 1 : 2) + ((work->descr->last_change.len == 0) ? 1 : 2)) /* EOT */ return (0); /* Error */