aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-08-08 09:33:01 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-08-08 09:36:32 +0200
commitc6a0f3884ebb85f6c9b6eec631ac78b6fe27f4f5 (patch)
tree89a4353402e28ec8a4824c9e19af1590f833d5a2
parent736834ca957697d618b70979764bc422ab6952d2 (diff)
wgtpkg-install: search in subdir "htdocs" also
For widgets that are fully HTML, the search of the content was not checking the subdirectory "htdocs" that is enforced elsewhere. This commits add the search of the content in the subdirectory "htdocs". This is a temporarily fix. A better complete solution has to be delivered later. Bug-AGL: SPEC-808 Change-Id: I8bef7c4a31ff919827ceca05e203c2b277cf7657 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/wgtpkg-install.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/wgtpkg-install.c b/src/wgtpkg-install.c
index 79cb7fb..2b57a4e 100644
--- a/src/wgtpkg-install.c
+++ b/src/wgtpkg-install.c
@@ -295,6 +295,7 @@ static int check_one_content(const char *src, const char *type)
{
int rc;
struct stat s;
+ int fhtdocs, serr;
if (!src) {
ERROR("a content src is missing");
@@ -304,6 +305,16 @@ static int check_one_content(const char *src, const char *type)
/* TODO: when dealing with HTML and languages, the check should
* include i18n path search of widgets */
rc = fstatat(workdirfd, src, &s, AT_NO_AUTOMOUNT|AT_SYMLINK_NOFOLLOW);
+ if (rc < 0) {
+ serr = errno;
+ fhtdocs = openat(workdirfd, "htdocs", O_DIRECTORY|O_PATH);
+ if (fhtdocs >= 0) {
+ rc = fstatat(fhtdocs, src, &s, AT_NO_AUTOMOUNT|AT_SYMLINK_NOFOLLOW);
+ serr = errno;
+ close(fhtdocs);
+ }
+ errno = serr;
+ }
if (rc < 0)
ERROR("can't get info on content %s: %m", src);
else if (!S_ISREG(s.st_mode)) {