|
|
d1681e |
From a3cfdb4e3f32336f2fd16ac68bc4dc5a33e7f26e Mon Sep 17 00:00:00 2001
|
|
|
d1681e |
From: Xavi Hernandez <xhernandez@redhat.com>
|
|
|
d1681e |
Date: Thu, 12 Apr 2018 23:31:37 +0200
|
|
|
d1681e |
Subject: [PATCH 233/236] libglusterfs: fix comparison of a NULL dict with a
|
|
|
d1681e |
non-NULL dict
|
|
|
d1681e |
|
|
|
d1681e |
Function are_dicts_equal() had a bug when the first argument was NULL and
|
|
|
d1681e |
the second one wasn't NULL. In this case it incorrectly returned that the
|
|
|
d1681e |
dicts were different when they could be equal.
|
|
|
d1681e |
|
|
|
d1681e |
Upstream-patch: https://review.gluster.org/19861
|
|
|
d1681e |
BUG: 1569457
|
|
|
d1681e |
Change-Id: I0fc245c2e7d1395865a76405dbd05e5d34db3273
|
|
|
d1681e |
Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
|
|
|
d1681e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/136332
|
|
|
d1681e |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
d1681e |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
d1681e |
---
|
|
|
d1681e |
libglusterfs/src/dict.c | 16 ++++++++--------
|
|
|
d1681e |
1 file changed, 8 insertions(+), 8 deletions(-)
|
|
|
d1681e |
|
|
|
d1681e |
diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c
|
|
|
d1681e |
index ebcf694..36d91a7 100644
|
|
|
d1681e |
--- a/libglusterfs/src/dict.c
|
|
|
d1681e |
+++ b/libglusterfs/src/dict.c
|
|
|
d1681e |
@@ -188,17 +188,17 @@ are_dicts_equal (dict_t *one, dict_t *two,
|
|
|
d1681e |
if (!match)
|
|
|
d1681e |
match = dict_match_everything;
|
|
|
d1681e |
|
|
|
d1681e |
- cmp.dict = two;
|
|
|
d1681e |
- cmp.value_ignore = value_ignore;
|
|
|
d1681e |
- if (!two) {
|
|
|
d1681e |
- num_matches1 = dict_foreach_match (one, match, NULL,
|
|
|
d1681e |
- dict_null_foreach_fn, NULL);
|
|
|
d1681e |
+ if ((one == NULL) || (two == NULL)) {
|
|
|
d1681e |
+ num_matches1 = dict_foreach_match(one ? one : two, match, NULL,
|
|
|
d1681e |
+ dict_null_foreach_fn, NULL);
|
|
|
d1681e |
goto done;
|
|
|
d1681e |
- } else {
|
|
|
d1681e |
- num_matches1 = dict_foreach_match (one, match, NULL,
|
|
|
d1681e |
- key_value_cmp, &cmp);
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
+ cmp.dict = two;
|
|
|
d1681e |
+ cmp.value_ignore = value_ignore;
|
|
|
d1681e |
+ num_matches1 = dict_foreach_match (one, match, NULL, key_value_cmp,
|
|
|
d1681e |
+ &cmp);
|
|
|
d1681e |
+
|
|
|
d1681e |
if (num_matches1 == -1)
|
|
|
d1681e |
return _gf_false;
|
|
|
d1681e |
|
|
|
d1681e |
--
|
|
|
d1681e |
1.8.3.1
|
|
|
d1681e |
|