Instead of returning the result of mpz_cmp(), this function returned 1
unless both elements were equal and the first one had
EXPR_F_INTERVAL_END set.

Signed-off-by: Phil Sutter <p...@nwl.cc>
---
 src/segtree.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/segtree.c b/src/segtree.c
index a2316a7b98041..f53536210018d 100644
--- a/src/segtree.c
+++ b/src/segtree.c
@@ -602,10 +602,12 @@ static int expr_value_cmp(const void *p1, const void *p2)
        int ret;
 
        ret = mpz_cmp(expr_value(e1)->value, expr_value(e2)->value);
-       if (ret == 0 && (e1->flags & EXPR_F_INTERVAL_END))
-               return -1;
-       else
-               return 1;
+       if (ret == 0) {
+               if (e1->flags & EXPR_F_INTERVAL_END)
+                       return -1;
+               else if (e2->flags & EXPR_F_INTERVAL_END)
+                       return 1;
+       }
 
        return ret;
 }
-- 
2.13.1

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to