Fix installation of more than one widget
authorJosé Bollo <jose.bollo@iot.bzh>
Mon, 12 Sep 2016 13:20:06 +0000 (15:20 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Mon, 12 Sep 2016 13:20:06 +0000 (15:20 +0200)
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>
src/wgtpkg-install.c
src/wgtpkg-permissions.c
src/wgtpkg-permissions.h

index 7d0c318..c4e70e3 100644 (file)
@@ -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;
index 6aed31f..c341054 100644 (file)
@@ -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 */
index 9a99c4c..5c44974 100644 (file)
@@ -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);