diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2019-12-13 14:14:10 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2020-04-21 10:54:43 +0300 |
commit | 7140ddab496157befeb39cc27cb96ebe6439f18c (patch) | |
tree | 26229b5c197ad817a575b590f5a1684b277e635c | |
parent | 0f5ef70be97e6f8242b476a339fa0ca9e49d0ff4 (diff) | |
download | rpm-7140ddab496157befeb39cc27cb96ebe6439f18c.tar.gz |
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)
(cherry picked from commit 4a71a3eccd7e9e14ee0e83b1cb300386a93622cd)
-rw-r--r-- | plugins/selinux.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/selinux.c b/plugins/selinux.c index 25e34783a..32c3b7529 100644 --- a/plugins/selinux.c +++ b/plugins/selinux.c @@ -161,13 +161,13 @@ 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); - if (rpmIsDebug()) { - rpmlog(RPMLOG_DEBUG, "lsetfilecon: (%s, %s) %s\n", - path, scon, (rc < 0 ? strerror(errno) : "")); - } - if (conrc == 0 || (conrc < 0 && errno == EOPNOTSUPP)) rc = RPMRC_OK; + + rpmlog((rc != RPMRC_OK) ? RPMLOG_ERR : RPMLOG_DEBUG, + "lsetfilecon: (%s, %s) %s\n", + path, scon, (conrc < 0 ? strerror(errno) : "")); + freecon(scon); } else { /* No context for dest is not our headache */ |