X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fwgtpkg-permissions.c;h=abb4596a76a48e2aa75e37f282680da9530eec67;hb=2a319cf90daa6e3b01e8139923f7073e1c9bcf28;hp=dcee64567d3bbc14b794996a98ed9bd6313212ce;hpb=1840ae0c704640319f52706fc72e881a2bae6afd;p=src%2Fapp-framework-main.git diff --git a/src/wgtpkg-permissions.c b/src/wgtpkg-permissions.c index dcee645..abb4596 100644 --- a/src/wgtpkg-permissions.c +++ b/src/wgtpkg-permissions.c @@ -1,5 +1,5 @@ /* - Copyright 2015 IoT.bzh + Copyright (C) 2015-2019 IoT.bzh author: José Bollo @@ -129,13 +129,25 @@ int permission_exists(const char *name) /* request the permission, returns 1 if granted or 0 otherwise */ int request_permission(const char *name) { +#define HACK_ALLOWING_REQUESTED_PERMISSIONS 1 + struct permission *p = get_permission(name); + +#if defined(HACK_ALLOWING_REQUESTED_PERMISSIONS) && HACK_ALLOWING_REQUESTED_PERMISSIONS + if (!p) + p = add_permission(name); +#endif if (p) { +#if defined(HACK_ALLOWING_REQUESTED_PERMISSIONS) && HACK_ALLOWING_REQUESTED_PERMISSIONS + p->granted = 1; +#endif p->requested = 1; if (p->granted) return 1; } return 0; + +#undef HACK_ALLOWING_REQUESTED_PERMISSIONS } /* iteration over granted and requested permissions */