All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libselinux: selinux_status_open: return 1 in fallback mode
@ 2021-06-01 15:05 Christian Göttsche
  2021-06-03 11:19 ` Petr Lautrbach
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Göttsche @ 2021-06-01 15:05 UTC (permalink / raw)
  To: selinux

In case of a recurring call to `selinux_status_open(3)`, which
previously has been opened in fallback mode, return `1` according to its
documentation.

Fixes: c5a699046f4 ("libselinux: make selinux_status_open(3) reentrant")

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 libselinux/src/sestatus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libselinux/src/sestatus.c b/libselinux/src/sestatus.c
index 531a522c..89c1f621 100644
--- a/libselinux/src/sestatus.c
+++ b/libselinux/src/sestatus.c
@@ -283,7 +283,7 @@ int selinux_status_open(int fallback)
 	uint32_t	seqno;
 
 	if (selinux_status != NULL) {
-		return 0;
+		return (selinux_status == MAP_FAILED) ? 1 : 0;
 	}
 
 	if (!selinux_mnt) {
-- 
2.32.0.rc2


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

end of thread, other threads:[~2021-06-09  9:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-01 15:05 [PATCH] libselinux: selinux_status_open: return 1 in fallback mode Christian Göttsche
2021-06-03 11:19 ` Petr Lautrbach
2021-06-09  9:30   ` Petr Lautrbach

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.