From: Sung-hun Kim Date: Mon, 29 Aug 2022 07:32:33 +0000 (+0900) Subject: resource-monitor: Use pass_resource_monitor_set_resource_flag to make the resource... X-Git-Tag: submit/tizen/20220901.084153^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F08%2F280608%2F4;p=platform%2Fcore%2Fapi%2Fresource-monitor.git resource-monitor: Use pass_resource_monitor_set_resource_flag to make the resource PUBLIC Some information should be protected from public users. So the users of capi only can access to attirbutes which have PUBLIC visibility. By using the added libpass function, we can enforce the user of capi to only access PUBLIC attributes. If the user tries to access PRIVATE attributes, the set attribute function will return RESOURCE_MONITOR_ERROR_PERMISSION_DENIED error. Change-Id: If7f40a7cf4e2c0987fa3594a6e3e3f0839c0aded Signed-off-by: Sung-hun Kim --- diff --git a/src/resource-monitor.c b/src/resource-monitor.c index 6bcaf35..d304ddd 100644 --- a/src/resource-monitor.c +++ b/src/resource-monitor.c @@ -39,7 +39,16 @@ int resource_monitor_get_resource_count(int monitor_id, resource_monitor_type_e int resource_monitor_create_resource(int monitor_id, resource_monitor_type_e resource_type) { - return pass_resource_monitor_create_resource(monitor_id, resource_type); + int ret; + int resource_id = pass_resource_monitor_create_resource(monitor_id, resource_type); + + if (resource_id < 0) + return resource_id; + + ret = pass_resource_monitor_set_resource_flag(monitor_id, resource_id, RESOURCE_FLAG_PUBLIC); + if (ret < 0) + return ret; + return resource_id; } int resource_monitor_delete_resource(int monitor_id, int resource_id)