summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-03-14 10:04:41 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2017-03-14 10:21:05 +0100
commit6506c0c80b7542ca97149d9a53d88f5f0b7a0d2d (patch)
tree27b58661f3e6432eef2b5b02ed043b1d418bce38
parent7d393034b463ba47d882ee2202a51ac20c09e8d4 (diff)
Splits the widget validation function
Change-Id: I543995c8bb64a859a7c0eb6cc09217d2f71ccc38 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/wgtpkg-install.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/wgtpkg-install.c b/src/wgtpkg-install.c
index 31c9e91..93c2bbc 100644
--- a/src/wgtpkg-install.c
+++ b/src/wgtpkg-install.c
@@ -129,12 +129,12 @@ static int set_required_permissions(struct wgt_desc_param *params, int required)
return 0;
}
-static int check_widget(const struct wgt_desc *desc)
+static int check_permissions(const struct wgt_desc *desc)
{
int result;
const struct wgt_desc_feature *feature;
- result = check_temporary_constraints(desc);
+ result = 0;
feature = desc->features;
while(result >= 0 && feature) {
if (!strcmp(feature->name, feature_required_permission))
@@ -144,6 +144,16 @@ static int check_widget(const struct wgt_desc *desc)
return result;
}
+static int check_widget(const struct wgt_desc *desc)
+{
+ int result;
+
+ result = check_temporary_constraints(desc);
+ if (result >= 0)
+ result = check_permissions(desc);
+ return result;
+}
+
static int get_target_directory(char target[PATH_MAX], const char *root, const struct wgt_desc *desc)
{
int rc;