diff options
Diffstat (limited to 'tests/encryption-scheme/smack-access.cpp')
-rw-r--r-- | tests/encryption-scheme/smack-access.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/encryption-scheme/smack-access.cpp b/tests/encryption-scheme/smack-access.cpp index 960ea129..41a8ec0f 100644 --- a/tests/encryption-scheme/smack-access.cpp +++ b/tests/encryption-scheme/smack-access.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2000 - 2018 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,14 +20,16 @@ * @version 1.0 */ -#include <sys/smack.h> +#include <stdexcept> -#include <assert-wrapper.h> #include <smack-access.h> +#include <sys/smack.h> + SmackAccess::SmackAccess() : m_handle(nullptr) { - ASSERT_MSG(smack_accesses_new(&m_handle) == 0, "smack_accesses_new failed"); + if (0 != smack_accesses_new(&m_handle)) + throw std::runtime_error("smack_accesses_new failed"); } void SmackAccess::add( @@ -35,13 +37,15 @@ void SmackAccess::add( const std::string &object, const std::string &rights) { - ASSERT_MSG(smack_accesses_add(m_handle, subject.c_str(), object.c_str(), rights.c_str()) == 0, - "smack_accesses_add failed"); + if (0 != smack_accesses_add(m_handle, subject.c_str(), object.c_str(), + rights.c_str())) + throw std::runtime_error("smack_accesses_add failed"); } void SmackAccess::apply() { - ASSERT_MSG(smack_accesses_apply(m_handle) == 0, "smack_accesses_apply failed"); + if (0 != smack_accesses_apply(m_handle)) + throw std::runtime_error("smack_accesses_apply failed"); } SmackAccess::~SmackAccess() |