From 4d932ecb8f67e2754410e7608ce873fcb646c270 Mon Sep 17 00:00:00 2001 From: Krzysztof Jackiewicz Date: Fri, 28 Jun 2019 11:39:32 +0200 Subject: [PATCH] CKM: Handle the empty onlycap case properly In case of empty onlycap the original process label was not restored properly leading to failures in following tests. Change-Id: I9e4cdce234b425887da07892773f21465087c4a6 --- src/common/scoped_process_label.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/scoped_process_label.cpp b/src/common/scoped_process_label.cpp index 47872bcc..793a6ef6 100644 --- a/src/common/scoped_process_label.cpp +++ b/src/common/scoped_process_label.cpp @@ -122,7 +122,6 @@ ScopedProcessLabel::ScopedProcessLabel(std::string label, bool restore) : newOnlycap.insert(m_label); smackSetOnlycap(newOnlycap); } else { - m_originalLabel.clear(); m_originalOnlycap.clear(); } } @@ -135,7 +134,8 @@ ScopedProcessLabel::~ScopedProcessLabel() if (!m_originalLabel.empty()) { try { smackSetLabelForSelf(m_originalLabel); - smackSetOnlycap(m_originalOnlycap); + if (!m_originalOnlycap.empty()) + smackSetOnlycap(m_originalOnlycap); } catch (const DPL::Test::TestException& e) { RUNNER_ERROR_MSG("Test exception occurred: " << e.GetMessage()); } catch (const std::exception& e) { -- 2.34.1