Try to improves the error message after exec
[src/app-framework-main.git] / src / afm-launch.c
index d31e24b..d80e43b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- Copyright 2015, 2016 IoT.bzh
+ Copyright 2015, 2016, 2017 IoT.bzh
 
  author: José Bollo <jose.bollo@iot.bzh>
 
@@ -731,6 +731,9 @@ static pid_t launch(
 
        close(rpipe[0]);
 
+       /* set name by appid */
+       verbose_set_name(desc->appid, 0);
+
        /* avoid set-gid effect */
        setresgid(groupid, groupid, groupid);
 
@@ -768,6 +771,7 @@ static pid_t launch(
 
        /* executes the process */
        rc = execve(args[0], args, env);
+       access(args[0], X_OK);
        ERROR("failed to exec master %s: %m", args[0]);
        _exit(1);
        return -1;
@@ -856,7 +860,7 @@ static struct desc_launcher *search_launcher(const char *type,
        for (dl = launchers ; dl ; dl = dl->next)
                if (dl->mode == mode)
                        for (tl = dl->types ; tl != NULL ; tl = tl->next)
-                               if (!strcmp(tl->type, type))
+                               if (!strcasecmp(tl->type, type))
                                        return dl;
        return NULL;
 }