From 65098693d4ad9a91ba51a23359f8cd546559851d Mon Sep 17 00:00:00 2001 From: Vyacheslav Cherkashin Date: Tue, 2 May 2017 16:10:50 +0300 Subject: [PATCH] Check the instrumentation list on same apps Change-Id: Id60d0eb1fd9b13787f44a5ffe289d53cf1b1a3e8 Signed-off-by: Vyacheslav Cherkashin --- daemon/da_protocol_inst.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/daemon/da_protocol_inst.c b/daemon/da_protocol_inst.c index 4cd9afd..6f8ad08 100644 --- a/daemon/da_protocol_inst.c +++ b/daemon/da_protocol_inst.c @@ -387,6 +387,21 @@ exit: return res; } +static bool app_inst_list_path_contain_in(const char *path) +{ + struct app_list_t *app = NULL; + struct app_info_t *app_info = NULL; + + for (app_info = app_info_get_first(&app); + app_info != NULL; + app_info = app_info_get_next(&app)) { + if (!strcmp(app_info->exe_path, path)) + return true; + } + + return false; +} + int parse_app_inst_list(struct msg_buf_t *msg, uint32_t *num, struct app_list_t **app_list) @@ -403,6 +418,7 @@ int parse_app_inst_list(struct msg_buf_t *msg, parse_deb("app_int_num = %d\n", *num); for (i = 0; i < *num; i++) { int err; + const char *path; struct app_info_t *info; parse_deb("app_int #%d\n", i); @@ -412,6 +428,12 @@ int parse_app_inst_list(struct msg_buf_t *msg, goto exit_fail_clean_list; } + path = app->app->exe_path; + if (app_inst_list_path_contain_in(path)) { + LOGE("App path is already used, path='%s'\n", path); + goto exit_fail_release_app; + } + info = app->app; err = fm_app_add(info->app_type, info->app_id, info->exe_path, info->setup_data.data, info->setup_data.size); -- 2.7.4