+static int install_file_properties(const struct wgt_desc *desc)
+{
+ int rc, rc2;
+ struct wgt_desc_feature *feat;
+ struct wgt_desc_param *param;
+
+ rc = 0;
+ feat = desc->features;
+ while (feat) {
+ if (!strcmp(feat->name, FWK_PREFIX"widget:file-properties")) {
+ param = feat->params;
+ while (param) {
+ if (!strcmp(param->value, "executable")) {
+ rc2 = fchmodat(workdirfd, param->name, 0755, 0);
+ if (rc2 < 0)
+ ERROR("can't make executable the file %s: %m", param->name);
+ } else {
+ ERROR("unknown file property %s for %s", param->value, param->name);
+ errno = EINVAL;
+ rc2 = -1;
+ }
+ if (rc2 < 0 && !rc)
+ rc = rc2;
+ param = param->next;
+ }
+ }
+ feat = feat->next;
+ }
+ return rc;
+}
+
+static int is_path_public(const char *path, const struct wgt_desc *desc)
+{
+ const struct wgt_desc_icon *icon;
+ const struct wgt_desc_feature *feat;
+ const struct wgt_desc_param *param;
+ size_t len;
+
+ /* icons are public */
+ icon = desc->icons;
+ while (icon != NULL) {
+ len = strlen(icon->src);
+ if (!memcmp(path, icon->src, len) && (path[len] == 0 || path[len] == '/'))
+ return 1;
+ icon = icon->next;
+ }
+
+ /* provided bindings are public */
+ feat = desc->features;
+ while (feat != NULL) {
+ if (strcasecmp(feat->name, "urn:AGL:widget:provided-binding") == 0
+ || strcasecmp(feat->name, "urn:AGL:widget:public-files") == 0) {
+ param = feat->params;
+ while(param != NULL) {
+ if (strcmp(param->value, path) == 0)
+ return 1;
+ param = param->next;
+ }
+ }
+ feat = feat->next;
+ }
+
+ /* otherwise no */
+ return 0;
+}
+