Silence spurious error message from lsetfilecon()

This commit is contained in:
openeuler-basic 2020-03-06 14:33:19 +08:00
parent dd57a38c74
commit 9fdfdced11
7 changed files with 49 additions and 6 deletions

View File

@ -0,0 +1,36 @@
From 4a71a3eccd7e9e14ee0e83b1cb300386a93622cd Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Fri, 13 Dec 2019 14:14:10 +0200
Subject: [PATCH] Silence spurious error message from lsetfilecon() on
-EOPNOTSUPP
We already filter out -EOPNOTSUPP and return OK, but the message was
getting logged before the filtering so we'd spit out spurious error
messages on filesystems that don't support SELinux (RhBug:1777502)
---
plugins/selinux.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/plugins/selinux.c b/plugins/selinux.c
index a51f95e..ba37ffa 100644
--- a/plugins/selinux.c
+++ b/plugins/selinux.c
@@ -168,11 +168,12 @@ static rpmRC selinux_fsm_file_prepare(rpmPlugin plugin, rpmfi fi,
if (selabel_lookup_raw(sehandle, &scon, dest, file_mode) == 0) {
int conrc = lsetfilecon(path, scon);
- rpmlog(loglvl(conrc < 0), "lsetfilecon: (%s, %s) %s\n",
- path, scon, (conrc < 0 ? strerror(errno) : ""));
-
if (conrc == 0 || (conrc < 0 && errno == EOPNOTSUPP))
rc = RPMRC_OK;
+
+ rpmlog(loglvl(rc != RPMRC_OK), "lsetfilecon: (%s, %s) %s\n",
+ path, scon, (conrc < 0 ? strerror(errno) : ""));
+
freecon(scon);
} else {
/* No context for dest is not our headache */
--
1.8.3.1

View File

@ -1,19 +1,20 @@
Name: rpm
Version: 4.15.1
Release: 11
Release: 12
Summary: RPM Package Manager
License: GPLv2+
URL: http://www.rpm.org/
Source0: http://ftp.rpm.org/releases/rpm-4.15.x/%{name}-%{version}.tar.bz2
Patch1: 0001-Unbundle-config-site-and-add-RPM-LD-FLAGS-macro.patch
Patch1: Unbundle-config-site-and-add-RPM-LD-FLAGS-macro.patch
Patch2: rpm-4.12.0-rpm2cpio-hack.patch
Patch3: 0001-find-debuginfo.sh-decompress-DWARF-compressed-ELF-se.patch
Patch4: 0001-skip-updating-the-preferences.patch
Patch5: 0001-add-dist-to-release-by-default.patch
Patch3: find-debuginfo.sh-decompress-DWARF-compressed-ELF-se.patch
Patch4: skip-updating-the-preferences.patch
Patch5: add-dist-to-release-by-default.patch
Patch6: Silence-spurious-error-message-from-lsetfilecon-on-E.patch
Patch9000: bugfix-rpm-4.11.3-add-aarch64_ilp32-arch.patch
Patch9001: 0001-bugfix-rpm-4.14.2-fix-tty-failed.patch
Patch9001: bugfix-rpm-4.14.2-fix-tty-failed.patch
Patch9002: bugfix-rpm-4.14.2-wait-once-get-rpmlock-fail.patch
BuildRequires: gcc autoconf automake libtool make gawk popt-devel openssl-devel readline-devel libdb-devel
@ -281,6 +282,12 @@ make check || (cat tests/rpmtests.log; exit 0)
%{_mandir}/man1/gendiff.1*
%changelog
* Fri Mar 6 2020 openEuler Buildteam <buildteam@openeuler.org> - 4.15.1-12
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:silence spurious error message from lsetfilecon()
* Wed Mar 4 2020 openEuler Buildteam <buildteam@openeuler.org> - 4.15.1-11
- Type:bugfix
- ID:NA