libselinux/0032-libselinux-selinux_status_open-return-1-in-fallback-.patch

37 lines
1.1 KiB
Diff
Raw Normal View History

From ed2e4db2f9941e01e65248ce5f0a9e49f3efd130 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
Date: Tue, 1 Jun 2021 17:05:23 +0200
Subject: [PATCH] libselinux: selinux_status_open: return 1 in fallback mode
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Acked-by: Petr Lautrbach <plautrba@redhat.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 531a522c0f48..89c1f6216702 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