X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafm-binding.c;h=f4bba8a9b485ace6fa8b1e3183416f46fab6f8c5;hb=7ecf0c1b7fb926f8e5c7a49a4959d59509599cc9;hp=5fb1f73d32e66bb3468089b34459bfc410862af4;hpb=bceaf2cc403176fd808d4e00be893671be3f4bb0;p=src%2Fapp-framework-main.git diff --git a/src/afm-binding.c b/src/afm-binding.c index 5fb1f73..f4bba8a 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) { @@ -237,7 +244,7 @@ static int onappid(afb_req_t req, const char *method, const char **appid) /* get the appid if any */ if (!wrap_json_unpack(json, "s", appid) - || !wrap_json_unpack(json, "{si}", _id_, appid)) { + || !wrap_json_unpack(json, "{ss}", _id_, appid)) { /* found */ INFO("method %s called for %s", method, *appid); return 1; @@ -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; }