diff --git a/src/cli.c b/src/cli.c index 16ddf0526..fad064b92 100644 --- a/src/cli.c +++ b/src/cli.c @@ -2982,11 +2982,19 @@ int mworker_cli_sockpair_new(struct mworker_proc *mworker_proc, int proc) global.maxsock++; /* for the listening socket */ } + /* the sockpair was asssigned successfully to the listener for the + * worker, we can remove it from the mworker_proc, so it's not used + * elsewhere accidentally + */ + mworker_proc->ipc_fd[1] = -1; + return 0; error: close(mworker_proc->ipc_fd[0]); close(mworker_proc->ipc_fd[1]); + mworker_proc->ipc_fd[0] = -1; + mworker_proc->ipc_fd[1] = -1; free(err); return -1;