exit(127);
}
+static void
+instance_free_stdio(struct service_instance *in)
+{
+ if (in->_stdout.fd.fd > -1) {
+ ustream_free(&in->_stdout.stream);
+ close(in->_stdout.fd.fd);
+ in->_stdout.fd.fd = -1;
+ }
+
+ if (in->_stderr.fd.fd > -1) {
+ ustream_free(&in->_stderr.stream);
+ close(in->_stderr.fd.fd);
+ in->_stderr.fd.fd = -1;
+ }
+}
+
void
instance_start(struct service_instance *in)
{
if (in->proc.pending)
return;
+ instance_free_stdio(in);
if (in->_stdout.fd.fd > -2) {
if (pipe(opipe)) {
ULOG_WARN("pipe() failed: %d (%s)\n", errno, strerror(errno));
void
instance_free(struct service_instance *in)
{
- if (in->_stdout.fd.fd > -1) {
- ustream_free(&in->_stdout.stream);
- close(in->_stdout.fd.fd);
- }
-
- if (in->_stderr.fd.fd > -1) {
- ustream_free(&in->_stderr.stream);
- close(in->_stderr.fd.fd);
- }
-
+ instance_free_stdio(in);
uloop_process_delete(&in->proc);
uloop_timeout_cancel(&in->timeout);
trigger_del(in);
if (in->respawn) {
void *r = blobmsg_open_table(b, "respawn");
- blobmsg_add_u32(b, "timeout", in->respawn_timeout);
blobmsg_add_u32(b, "threshold", in->respawn_threshold);
+ blobmsg_add_u32(b, "timeout", in->respawn_timeout);
blobmsg_add_u32(b, "retry", in->respawn_retry);
blobmsg_close_table(b, r);
}