rpc_ustream_to_blobmsg(&c->blob, &c->opipe.stream, "stdout");
rpc_ustream_to_blobmsg(&c->blob, &c->epipe.stream, "stderr");
}
+ }
- if (c->finish_cb)
- rv = c->finish_cb(&c->blob, c->stat, c->priv);
+ if (c->finish_cb)
+ rv = c->finish_cb(&c->blob, c->stat, c->priv);
- if (rv == UBUS_STATUS_OK)
- ubus_send_reply(c->context, &c->request, c->blob.head);
- }
+ if (rv == UBUS_STATUS_OK)
+ ubus_send_reply(c->context, &c->request, c->blob.head);
ubus_complete_deferred_request(c->context, &c->request, rv);
switch ((pid = fork()))
{
case -1:
- return rpc_errno_status();
+ goto fail_fork;
case 0:
uloop_done();
uloop_process_add(&c->process);
c->timeout.cb = rpc_exec_timeout_cb;
- uloop_timeout_set(&c->timeout, exec_timeout);
+ uloop_timeout_set(&c->timeout, rpc_exec_timeout);
if (c->stdin_cb)
{
return UBUS_STATUS_OK;
+fail_fork:
+ close(epipe[0]);
+ close(epipe[1]);
+
fail_epipe:
close(opipe[0]);
close(opipe[1]);
close(ipipe[1]);
fail_ipipe:
+ free(c);
return rpc_errno_status();
}