mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-11 05:48:41 +00:00
MINOR: mworker: sets used or closed worker FDs to -1
mworker_cli_sockpair_new() is used to create the socketpair CLI listener of the worker. Its FD is referenced in the mworker_proc structure, however, once it's assigned to the listener the reference should be removed so we don't use it accidentally. The same must be done in case of errors if the FDs were already closed.
This commit is contained in:
parent
21ea8c5198
commit
ea7371e934
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user