selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] python/semanage: check rc after getting it
@ 2020-04-19 14:00 Nicolas Iooss
  2020-04-20 14:28 ` Roberts, William C
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Iooss @ 2020-04-19 14:00 UTC (permalink / raw)
  To: selinux

This issue has been found using lgtm.com:
https://lgtm.com/projects/g/SELinuxProject/selinux/snapshot/4946f674a6da9cc368cc826f963aedd39b6a94cf/files/python/semanage/seobject.py?sort=name&dir=ASC&mode=heatmap#x5c052fffe98aee02:1

Fixes: 49706ad9f808 ("Revised Patch for local nodecon support in
semanage (was: Adding local nodecon's through semanage)")
Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
---
 python/semanage/seobject.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py
index 0e9ce2900892..f2a139c970bd 100644
--- a/python/semanage/seobject.py
+++ b/python/semanage/seobject.py
@@ -1895,10 +1895,10 @@ class nodeRecords(semanageRecords):
         (rc, k) = semanage_node_key_create(self.sh, addr, mask, proto)
         if rc < 0:
             raise ValueError(_("Could not create key for %s") % addr)
-        if rc < 0:
-            raise ValueError(_("Could not check if addr %s is defined") % addr)
 
         (rc, exists) = semanage_node_exists(self.sh, k)
+        if rc < 0:
+            raise ValueError(_("Could not check if addr %s is defined") % addr)
         if exists:
             raise ValueError(_("Addr %s already defined") % addr)
 
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-22 21:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-19 14:00 [PATCH 1/1] python/semanage: check rc after getting it Nicolas Iooss
2020-04-20 14:28 ` Roberts, William C
2020-04-20 18:30   ` Nicolas Iooss
2020-04-20 18:37     ` Christian Göttsche
2020-04-20 22:24       ` William Roberts
2020-04-22 21:49   ` Roberts, William C

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).