!65 libsemanage: simplify file deletion
From: @chang111111 Reviewed-by: @mailofzxf Signed-off-by: @mailofzxf
This commit is contained in:
commit
80dd183e4e
63
backport-libsemanage-simplify-file-deletion.patch
Normal file
63
backport-libsemanage-simplify-file-deletion.patch
Normal file
@ -0,0 +1,63 @@
|
||||
From 46b6d4593fd0bf3286977a9fe7d48f849524543c Mon Sep 17 00:00:00 2001
|
||||
From: changhan <changhan@xfusion.com>
|
||||
Date: Fri, 18 Apr 2025 16:43:48 +0800
|
||||
Subject: [PATCH] libsemanage-simplify-file-deletion
|
||||
|
||||
Reference: https://github.com/SELinuxProject/selinux/commit/d3a5ae39bee42eac520a3d07f252251a2167a323
|
||||
|
||||
---
|
||||
src/direct_api.c | 24 +++++++++---------------
|
||||
1 file changed, 9 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/direct_api.c b/src/direct_api.c
|
||||
index 025b26e..03fc6ad 100644
|
||||
--- a/src/direct_api.c
|
||||
+++ b/src/direct_api.c
|
||||
@@ -2738,7 +2738,6 @@ static int semanage_direct_install_info(semanage_handle_t *sh,
|
||||
int status = 0;
|
||||
int ret = 0;
|
||||
int type;
|
||||
- struct stat sb;
|
||||
|
||||
char path[PATH_MAX];
|
||||
mode_t mask = umask(0077);
|
||||
@@ -2839,13 +2838,11 @@ static int semanage_direct_install_info(semanage_handle_t *sh,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- if (stat(path, &sb) == 0) {
|
||||
- ret = unlink(path);
|
||||
- if (ret != 0) {
|
||||
- ERR(sh, "Error while removing cached CIL file %s.", path);
|
||||
- status = -3;
|
||||
- goto cleanup;
|
||||
- }
|
||||
+ ret = unlink(path);
|
||||
+ if (ret != 0 && errno != ENOENT) {
|
||||
+ ERR(sh, "Error while removing cached CIL file %s.", path);
|
||||
+ status = -3;
|
||||
+ goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2942,13 +2939,10 @@ static int semanage_direct_remove_key(semanage_handle_t *sh,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- struct stat sb;
|
||||
- if (stat(path, &sb) == 0) {
|
||||
- ret = unlink(path);
|
||||
- if (ret != 0) {
|
||||
- status = -1;
|
||||
- goto cleanup;
|
||||
- }
|
||||
+ ret = unlink(path);
|
||||
+ if (ret != 0 && errno != ENOENT) {
|
||||
+ status = -1;
|
||||
+ goto cleanup;
|
||||
}
|
||||
}
|
||||
else {
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
Name: libsemanage
|
||||
Version: 3.5
|
||||
Release: 4
|
||||
Release: 5
|
||||
License: LGPLv2+
|
||||
Summary: SELinux binary policy manipulation library
|
||||
URL: https://github.com/SELinuxProject/selinux/wiki
|
||||
@ -23,6 +23,7 @@ Patch6009: backport-libsemanage-check-closing-written-files.patch
|
||||
Patch6010: backport-libsemanage-handle-cil_set_handle_unknown-failure.patch
|
||||
Patch6011: backport-libsemanage-handle-shell-allocation-failure.patch
|
||||
Patch6012: backport-libsemanage-drop-duplicate-newlines-and-error-descriptions-in-error-messages.patch
|
||||
Patch6013: backport-libsemanage-simplify-file-deletion.patch
|
||||
|
||||
Patch9000: fix-test-failure-with-secilc.patch
|
||||
|
||||
@ -118,6 +119,9 @@ make test
|
||||
|
||||
|
||||
%changelog
|
||||
* Sat Apr 19 2025 changhan <changhan@xfusion.com> - 3.5-5
|
||||
- backport libsemanage: simplify file deletion
|
||||
|
||||
* Fri Apr 18 2025 changhan <changhan@xfusion.com> - 3.5-4
|
||||
- backport libsemanage: drop duplicate newlines and error descriptions in error messages
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user