aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-09-12 15:20:06 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-09-12 15:20:06 +0200
commit66155de48c685b29d96ca95bc1a45078f8f4c681 (patch)
tree3f9351ce16fcc18f7bcf39938d147404e19667d4
parent8afd46f28a677c40a482ccd18ca5568cf6c0f6aa (diff)
Fix installation of more than one widget
Using command line tool, it is possible to install more than just one widget. Before this commit, the list of requested permission was not cleaned. Change-Id: Ic9311754f51f12d6231d1f08a55eb4b4aef0c74e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/wgtpkg-install.c1
-rw-r--r--src/wgtpkg-permissions.c10
-rw-r--r--src/wgtpkg-permissions.h1
3 files changed, 11 insertions, 1 deletions
diff --git a/src/wgtpkg-install.c b/src/wgtpkg-install.c
index 7d0c318..c4e70e3 100644
--- a/src/wgtpkg-install.c
+++ b/src/wgtpkg-install.c
@@ -253,6 +253,7 @@ struct wgt_info *install_widget(const char *wgtfile, const char *root, int force
if (!ifo)
goto error2;
+ reset_requested_permissions();
desc = wgt_info_desc(ifo);
if (check_widget(desc))
goto error3;
diff --git a/src/wgtpkg-permissions.c b/src/wgtpkg-permissions.c
index 6aed31f..c341054 100644
--- a/src/wgtpkg-permissions.c
+++ b/src/wgtpkg-permissions.c
@@ -81,7 +81,15 @@ void reset_permissions()
{
unsigned int i;
for (i = 0 ; i < nrpermissions ; i++)
- permissions[i].granted = 0;
+ permissions[i].granted = permissions[i].requested = 0;
+}
+
+/* remove any requested permission */
+void reset_requested_permissions()
+{
+ unsigned int i;
+ for (i = 0 ; i < nrpermissions ; i++)
+ permissions[i].requested = 0;
}
/* remove any granting */
diff --git a/src/wgtpkg-permissions.h b/src/wgtpkg-permissions.h
index 9a99c4c..5c44974 100644
--- a/src/wgtpkg-permissions.h
+++ b/src/wgtpkg-permissions.h
@@ -18,6 +18,7 @@
extern int is_standard_permission(const char *name);
extern void reset_permissions();
+extern void reset_requested_permissions();
extern void crop_permissions(unsigned level);
extern int grant_permission_list(const char *list);
extern int permission_exists(const char *name);