canonicalized.insert(target->getName());
} catch (const Exception &e) {
if (e.error() == CSR_ERROR_FILE_DO_NOT_EXIST ||
- e.error() == CSR_ERROR_FILE_SYSTEM) {
- WARN("File-system related exception occured while getting "
+ e.error() == CSR_ERROR_FILE_SYSTEM ||
+ e.error() == CSR_ERROR_PERMISSION_DENIED) {
+ WARN("File-system & permission related exception occured while getting "
"canonicalize path of path: " << path << " " << e.what() <<
". Ignore this exception.");
continue;
for (const auto &path : paths) {
try {
- auto target = canonicalizePath(File::getPkgPath(path), true);
+ auto target = canonicalizePath(path, true);
if (dirs.find(target) == dirs.end()) {
INFO("Insert to canonicalized list: " << target);
}
} catch (const Exception &e) {
if (e.error() == CSR_ERROR_FILE_DO_NOT_EXIST ||
- e.error() == CSR_ERROR_FILE_SYSTEM) {
- WARN("File-system related exception occured while getting "
+ e.error() == CSR_ERROR_FILE_SYSTEM ||
+ e.error() == CSR_ERROR_PERMISSION_DENIED) {
+ WARN("File-system & permission related exception occured while getting "
"canonicalize path of path: " << path << " " << e.what() <<
". Ignore this exception.");
continue;
EXCEPTION_GUARD_END
}
+BOOST_AUTO_TEST_CASE(scan_async_no_perm_dirs)
+{
+ EXCEPTION_GUARD_START
+
+ std::string tmp_no_perm_media = std::string() + TEST_DIR_MEDIA() + "/tak";
+ BOOST_MESSAGE("This TC needs special directory(" << tmp_no_perm_media << ") "
+ "which should be created manualy with special smack label to occur "
+ "smack-deny to open.");
+
+ auto c = Test::Context<csr_cs_context_h>();
+ auto context = c.get();
+
+ const char *dirs[3] = {
+ "/tmp",
+ tmp_no_perm_media.c_str(),
+ TEST_DIR_APPS()
+ };
+
+ set_default_callback(context);
+
+ AsyncTestContext testCtx;
+
+ ASSERT_SUCCESS(csr_cs_scan_dirs_async(context, dirs, 3, &testCtx));
+
+ ASSERT_CALLBACK(testCtx, -1, -1, 1, 0, 0);
+
+ EXCEPTION_GUARD_END
+}
+
BOOST_AUTO_TEST_SUITE_END()