- const char *appid = getappid(obj);
- struct json_object *appli = appid ? appfwk_get_application_public(appfwk, appid) : NULL;
- int runid = appfwk_run_start(appli);
- if (runid <= 0) {
-
- jbus_replyj(jreq, runid ? runid : error_not_found);
+ const char *appid;
+ struct json_object *appli;
+ int runid;
+ char runidstr[20];
+
+ appid = getappid(obj);
+ if (appid == NULL)
+ jbus_replyj(jreq, error_bad_request);
+ else {
+ appli = appfwk_get_application(appfwk, appid);
+ if (appli == NULL)
+ jbus_replyj(jreq, error_not_found);
+ else {
+ runid = appfwk_run_start(appli);
+ if (runid <= 0)
+ jbus_replyj(jreq, error_cant_start);
+ else {
+ snprintf(runidstr, sizeof runidstr, "%d", runid);
+ runidstr[sizeof runidstr - 1] = 0;
+ jbus_replyj(jreq, runidstr);
+ }
+ }
+ }