/*
- * Copyright (C) 2015-2019 "IoT.bzh"
+ * Copyright (C) 2015-2020 "IoT.bzh"
* Author José Bollo <jose.bollo@iot.bzh>
*
* Licensed under the Apache License, Version 2.0 (the "License");
/* launch the application */
runid = afm_urun_start(appli, afb_req_get_uid(req));
- if (runid <= 0) {
+ if (runid < 0) {
cant_start(req);
return;
}
#if 0
wrap_json_pack(&resp, "{si}", _runid_, runid);
#else
- wrap_json_pack(&resp, "i", runid);
+ if (runid)
+ wrap_json_pack(&resp, "i", runid);
#endif
afb_req_success(req, resp, NULL);
}
/* launch the application */
runid = afm_urun_once(appli, afb_req_get_uid(req));
- if (runid <= 0) {
+ if (runid < 0) {
cant_start(req);
return;
}
/* returns the state */
- resp = afm_urun_state(afudb, runid, afb_req_get_uid(req));
+ resp = runid ? afm_urun_state(afudb, runid, afb_req_get_uid(req)) : NULL;
afb_req_success(req, resp, NULL);
}