/* we hold a pipe open in the parent, and the any child
processes wait for EOF on that pipe. This ensures that
children die when the parent dies */
-static int child_pipe[2];
+static int child_pipe[2] = { -1, -1 };
/*
called when the process model is selected
tevent_add_fd(ev, ev, child_pipe[0], TEVENT_FD_READ,
standard_pipe_handler, NULL);
- close(child_pipe[1]);
+ if (child_pipe[1] != -1) {
+ close(child_pipe[1]);
+ child_pipe[1] = -1;
+ }
/* Ensure that the forked children do not expose identical random streams */
set_need_random_reseed();
tevent_add_fd(ev, ev, child_pipe[0], TEVENT_FD_READ,
standard_pipe_handler, NULL);
- close(child_pipe[1]);
+ if (child_pipe[1] != -1) {
+ close(child_pipe[1]);
+ child_pipe[1] = -1;
+ }
/* Ensure that the forked children do not expose identical random streams */
set_need_random_reseed();