sssd/0057-HBAC-Improve-readability-of-ipa_hbac_rule_info_send.patch

59 lines
2.1 KiB
Diff
Raw Normal View History

From dd6a4fb9ae4825caf4ccb835f8b8221c96bbb6f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Thu, 3 Aug 2017 08:02:32 +0200
Subject: [PATCH 57/93] HBAC: Improve readability of ipa_hbac_rule_info_send()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Move an if condition inside another if condition in order to make the
readability a little bit more clear that those checks are about the same
return code.
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
---
src/providers/ipa/ipa_hbac_rules.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/src/providers/ipa/ipa_hbac_rules.c b/src/providers/ipa/ipa_hbac_rules.c
index 404778da338f872c2b51c3d3539e7394e97385ab..d188971aa85dacf928657f5402dd96f66a6a521e 100644
--- a/src/providers/ipa/ipa_hbac_rules.c
+++ b/src/providers/ipa/ipa_hbac_rules.c
@@ -165,19 +165,18 @@ ipa_hbac_rule_info_send(TALLOC_CTX *mem_ctx,
state->rules_filter = talloc_steal(state, rule_filter);
ret = ipa_hbac_rule_info_next(req, state);
- if (ret == EOK) {
- /* ipa_hbac_rule_info_next should always have a search base when called
- * for the first time.
- *
- * For the subsequent iterations, not finding any more search bases is
- * fine though (thus the function returns EOK).
- *
- * As, here, it's the first case happening, let's return EINVAL.
- */
- ret = EINVAL;
- }
-
if (ret != EAGAIN) {
+ if (ret == EOK) {
+ /* ipa_hbac_rule_info_next should always have a search base when
+ * called for the first time.
+ *
+ * For the subsequent iterations, not finding any more search bases
+ * is fine though (thus the function returns EOK).
+ *
+ * As, here, it's the first case happening, let's return EINVAL.
+ */
+ ret = EINVAL;
+ }
goto immediate;
}
--
2.14.1