diff --git a/bundle/lib/source/DobbyConfig.cpp b/bundle/lib/source/DobbyConfig.cpp index 15db39f4b..6914222c2 100644 --- a/bundle/lib/source/DobbyConfig.cpp +++ b/bundle/lib/source/DobbyConfig.cpp @@ -791,31 +791,41 @@ bool DobbyConfig::updateBundleConfig(const ContainerId& id, std::shared_ptrd_name) >= (profile_len + 2)) { + if(!strncmp(cur_dir->d_name, profile, profile_len) && + cur_dir->d_name[profile_len] == '.' && + isdigit(cur_dir->d_name[profile_len + 1])) { + + status = true; + AI_LOG_INFO("AppArmor profile [%s] is loaded.", profile); + break; + } + } } - else - { - status = true; - AI_LOG_INFO("Apparmor profile [%s] is loaded", profile); + + if(!status) { + AI_LOG_INFO("AppArmor profile [%s] not found.", profile); } - close(fd); + if(!cur_dir && errno) { + AI_LOG_SYS_ERROR(errno, "readdir() failed on apparmorfs policy directory"); + } + + closedir(d); + return status; }