Fix ResTypePkgFilterChecker 61/286561/2
authorilho kim <ilho159.kim@samsung.com>
Tue, 10 Jan 2023 01:57:47 +0000 (10:57 +0900)
committerilho kim <ilho159.kim@samsung.com>
Tue, 10 Jan 2023 02:47:45 +0000 (11:47 +0900)
ResTypePkgFilterChecker filters the cached package information
to the resource type
Fix the the filter's behavior

Change-Id: Ia244ff932365be41b2fdb47c477644292058c85f
Signed-off-by: ilho kim <ilho159.kim@samsung.com>
src/server/filter_checker/pkg_filter_checker/restype_pkg_filter_checker.cc

index f1a5861..367fcfd 100644 (file)
@@ -21,8 +21,13 @@ namespace database {
 
 bool ResTypePkgFilterChecker::CheckFilter(pkgmgrinfo_node_x* node,
                                           package_x* info) {
-  return (info->removable == nullptr || info->removable[0] == '\0' ||
-          strcasecmp(node->value, info->removable) == 0);
+  if (!info->res_type)
+    return false;
+
+  if (node->value == nullptr || strlen(node->value) == 0)
+    return info->res_type != nullptr;
+  
+  return strcmp(node->value, info->res_type) == 0;
 }
 
 }  // namespace database