1 Star 0 Fork 20

yixiangzhike/libselinux

forked from src-openEuler/libselinux 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-libselinux-Close-old-selabel-handle-when-setting-a-n.patch 946 Bytes
一键复制 编辑 原始数据 按行查看 历史
yixiangzhike 提交于 2025-03-14 16:34 +08:00 . Backport upstream patches
From 45fdf23c7b37cfc776def253c0d5bfa1b0758c24 Mon Sep 17 00:00:00 2001
From: James Carter <jwcart2@gmail.com>
Date: Wed, 22 Jan 2025 10:58:27 -0500
Subject: [PATCH] libselinux: Close old selabel handle when setting a new one
In selinux_restorecon_set_sehandle(), close the old selabel handle
(if it exists) before setting the new one.
Signed-off-by: James Carter <jwcart2@gmail.com>
Acked-by: Petr Lautrbach <lautrbach@redhat.com>
---
src/selinux_restorecon.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/selinux_restorecon.c b/src/selinux_restorecon.c
index bc6ed935..ab1c5216 100644
--- a/src/selinux_restorecon.c
+++ b/src/selinux_restorecon.c
@@ -1367,6 +1367,10 @@ void selinux_restorecon_set_sehandle(struct selabel_handle *hndl)
unsigned char *fc_digest;
size_t num_specfiles, fc_digest_len;
+ if (fc_sehandle) {
+ selabel_close(fc_sehandle);
+ }
+
fc_sehandle = hndl;
if (!fc_sehandle)
return;
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yixiangzhike/libselinux.git
git@gitee.com:yixiangzhike/libselinux.git
yixiangzhike
libselinux
libselinux
master

搜索帮助