/*
- * Copyright (c) 2016 - 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016 - 2020 Samsung Electronics Co., Ltd All Rights Reserved
*
* Contact: Rafal Krypa <r.krypa@samsung.com>
*
return src && dst ? SECURITY_MANAGER_SUCCESS : SECURITY_MANAGER_ERROR_FILE_CREATE_FAILED;
}
-off_t fileSize(const std::string &path) {
- struct stat st;
- static_assert(std::is_same<off_t, decltype(st.st_size)>::value);
- static_assert(std::is_signed<off_t>::value);
- return -1 == lstat(path.c_str(), &st) || !S_ISREG(st.st_mode) ? -1 : st.st_size;
-}
-
} // namespace FS
} // namespace SecurityManager
/*
- * Copyright (c) 2016 - 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016 - 2020 Samsung Electronics Co., Ltd All Rights Reserved
*
* Contact: Rafal Krypa <r.krypa@samsung.com>
*
int removeFile(const std::string &path);
int symLink(const std::string &src, const std::string &dst);
int overwriteFile(const std::string &src, const std::string &dst);
-off_t fileSize(const std::string &path); // < 0 on error
} // namespace FS
} // namespace SecurityManager
if (empty)
BOOST_REQUIRE(fileContentsSame(TEST_DB_PATH DB_JOURNAL_SUFFIX, PRIVILEGE_DB_TEMPLATE DB_JOURNAL_SUFFIX));
else
- BOOST_REQUIRE(!FS::fileSize(TEST_DB_PATH DB_JOURNAL_SUFFIX));
+ BOOST_REQUIRE(fileEmpty(TEST_DB_PATH DB_JOURNAL_SUFFIX));
};
go({}, Marker::fallback, false);
go({}, Marker::fallback, true);