return;
service_anvil_monitor_start(service_list);
- if (pipe(service_list->master_dead_pipe_fd) < 0)
- i_error("pipe() failed: %m");
- fd_close_on_exec(service_list->master_dead_pipe_fd[0], TRUE);
- fd_close_on_exec(service_list->master_dead_pipe_fd[1], TRUE);
-
array_foreach(&service_list->services, services) {
struct service *service = *services;
if (service_login_create_notify_fd(service) < 0)
continue;
}
+ if (service->master_dead_pipe_fd[0] == -1) {
+ if (pipe(service->master_dead_pipe_fd) < 0) {
+ service_error(service, "pipe() failed: %m");
+ continue;
+ }
+ fd_close_on_exec(service->master_dead_pipe_fd[0], TRUE);
+ fd_close_on_exec(service->master_dead_pipe_fd[1], TRUE);
+ }
if (service->status_fd[0] == -1) {
/* we haven't yet created status pipe */
if (pipe(service->status_fd) < 0) {
service->status_fd[i] = -1;
}
}
+ if (service->master_dead_pipe_fd[0] != -1) {
+ i_close_fd(&service->master_dead_pipe_fd[0]);
+ i_close_fd(&service->master_dead_pipe_fd[1]);
+ }
if (service->login_notify_fd != -1) {
if (close(service->login_notify_fd) < 0) {
service_error(service,
{
struct service *const *services;
- if (service_list->master_dead_pipe_fd[0] != -1) {
- if (close(service_list->master_dead_pipe_fd[0]) < 0)
- i_error("close(master dead pipe) failed: %m");
- if (close(service_list->master_dead_pipe_fd[1]) < 0)
- i_error("close(master dead pipe) failed: %m");
- service_list->master_dead_pipe_fd[0] = -1;
- service_list->master_dead_pipe_fd[1] = -1;
- }
-
if (wait) {
/* we've notified all children that the master is dead.
now wait for the children to either die or to tell that
}
dup2_append(&dups, service->status_fd[1], MASTER_STATUS_FD);
if (service->type != SERVICE_TYPE_ANVIL) {
- dup2_append(&dups, service->list->master_dead_pipe_fd[1],
+ dup2_append(&dups, service->master_dead_pipe_fd[1],
MASTER_DEAD_FD);
} else {
dup2_append(&dups, global_master_dead_pipe_fd[1],
service->log_fd[1] = -1;
service->status_fd[0] = -1;
service->status_fd[1] = -1;
+ service->master_dead_pipe_fd[0] = -1;
+ service->master_dead_pipe_fd[1] = -1;
service->log_process_internal_fd = -1;
service->login_notify_fd = -1;
service_list->set = set;
service_list->master_log_fd[0] = -1;
service_list->master_log_fd[1] = -1;
- service_list->master_dead_pipe_fd[0] = -1;
- service_list->master_dead_pipe_fd[1] = -1;
service_settings = array_get(&set->services, &count);
p_array_init(&service_list->services, pool, count);
int status_fd[2];
struct io *io_status;
+ int master_dead_pipe_fd[2];
+
unsigned int throttle_secs;
time_t exit_failure_last;
unsigned int exit_failures_in_sec;
int master_log_fd[2];
struct service_process_notify *log_byes;
- int master_dead_pipe_fd[2];
-
ARRAY(struct service *) services;
bool destroying:1;