aboutsummaryrefslogtreecommitdiffstats
path: root/src/afm-binding.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2018-11-05 18:14:15 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2018-11-05 18:21:52 +0100
commite54b1f24aecedfccbb188dcbc9a7a9490cc248a8 (patch)
tree676f30b8d28011a1fb79369d6834dc8948ce9f20 /src/afm-binding.c
parente30b5998910afc888c9b4a79afb47e5d3fe4b3c4 (diff)
Treat correctly running/not running statusflounder_6.0.2flounder/6.0.26.0.2
Systemd returns 0 for services that don't run. It wasn't checked well causing weird effect: trying to terminate an application not running killed afm-system-daemon because kill(0) kills all processes of the group of the caller. Bug-AGL: SPEC-1836 Change-Id: I1bd64faf871ecd42aaaa5449312e8b8cb26ee9dd Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afm-binding.c')
-rw-r--r--src/afm-binding.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/afm-binding.c b/src/afm-binding.c
index 5fb1f73..037c108 100644
--- a/src/afm-binding.c
+++ b/src/afm-binding.c
@@ -49,6 +49,7 @@ static const char _id_[] = "id";
static const char _install_[] = "install";
static const char _lang_[] = "lang";
static const char _not_found_[] = "not-found";
+static const char _not_running_[] = "not-running";
static const char _once_[] = "once";
static const char _pause_[] = "pause";
static const char _resume_[] = "resume";
@@ -187,6 +188,12 @@ static void not_found(afb_req_t req)
afb_req_fail(req, _not_found_, NULL);
}
+/* common not running reply */
+static void not_running(afb_req_t req)
+{
+ afb_req_fail(req, _not_running_, NULL);
+}
+
/* common can't start reply */
static void cant_start(afb_req_t req)
{
@@ -283,7 +290,10 @@ static int onrunid(afb_req_t req, const char *method, int *runid)
/* nothing appropriate */
INFO("method %s can't get runid for %s: %m", method,
appid);
- not_found(req);
+ if (errno == ESRCH)
+ not_running(req);
+ else
+ not_found(req);
return 0;
}